add tests batch 20
This commit is contained in:
@@ -29,22 +29,22 @@ class OpenApiRouteExporter
|
||||
|
||||
private function mergeRoute(array &$paths, Route $route): void
|
||||
{
|
||||
if (! $this->isDocumentableRoute($route)) {
|
||||
if (!$this->isDocumentableRoute($route)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$uriRaw = ltrim($route->uri(), '/');
|
||||
if (str_starts_with($uriRaw, 'api/')) {
|
||||
$uri = '/'.$uriRaw;
|
||||
$uri = '/' . $uriRaw;
|
||||
} elseif (str_starts_with($uriRaw, 'v1/')) {
|
||||
$uri = '/api/'.$uriRaw;
|
||||
$uri = '/api/' . $uriRaw;
|
||||
} elseif ($uriRaw === 'v1') {
|
||||
$uri = '/api/v1';
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
if (! str_starts_with($uri, '/api/v1')) {
|
||||
if (!str_starts_with($uri, '/api/v1')) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ class OpenApiRouteExporter
|
||||
$tag = $this->resolveTag($uri);
|
||||
foreach ($methods as $method) {
|
||||
$lower = strtolower($method);
|
||||
if (! isset($paths[$uri][$lower])) {
|
||||
if (!isset($paths[$uri][$lower])) {
|
||||
$paths[$uri][$lower] = [
|
||||
'tags' => [$tag],
|
||||
'summary' => $this->summaryFromAction($route),
|
||||
@@ -73,12 +73,12 @@ class OpenApiRouteExporter
|
||||
private function isDocumentableRoute(Route $route): bool
|
||||
{
|
||||
$uri = ltrim($route->uri(), '/');
|
||||
if (! str_starts_with($uri, 'api/v1') && ! str_starts_with($uri, 'v1/')) {
|
||||
if (!str_starts_with($uri, 'api/v1') && !str_starts_with($uri, 'v1/')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$action = $route->getActionName();
|
||||
if (! is_string($action)) {
|
||||
if (!is_string($action)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -120,13 +120,11 @@ class OpenApiRouteExporter
|
||||
if (is_string($action) && str_contains($action, '@')) {
|
||||
[$controller, $method] = explode('@', $action, 2);
|
||||
$base = class_basename($controller);
|
||||
|
||||
return $base.'::'.$method;
|
||||
return $base . '::' . $method;
|
||||
}
|
||||
if (is_string($action)) {
|
||||
return $action;
|
||||
}
|
||||
|
||||
return 'Endpoint';
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user