Skip to content

Commit c5ae3ae

Browse files
committed
Merge remote-tracking branch 'origin/plugin-arch' into plugin-arch
# Conflicts: # src/Tools/Generator.php
2 parents ffb3563 + 1a0bff3 commit c5ae3ae

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

src/Strategies/Responses/ResponseCalls.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ private function shouldMakeApiCall(Route $route, array $rulesToApply, array $con
304304
return false;
305305
}
306306

307-
if (!empty($context['responses'])) {
307+
if (! empty($context['responses'])) {
308308
// Don't attempt a response call if there are already responses
309309
return false;
310310
}

src/Strategies/Responses/UseResponseFileTag.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
use Illuminate\Routing\Route;
66
use Mpociot\Reflection\DocBlock;
7-
use Illuminate\Http\JsonResponse;
87
use Mpociot\Reflection\DocBlock\Tag;
98
use Mpociot\ApiDoc\Strategies\Strategy;
109
use Mpociot\ApiDoc\Tools\RouteDocBlocker;
@@ -65,6 +64,6 @@ protected function getFileResponses(array $tags)
6564
}, $responseFileTags);
6665

6766
// Convert responses to [200 => 'response', 401 => 'response']
68-
return collect($responses)->pluck("0", "1")->toArray();
67+
return collect($responses)->pluck('0', '1')->toArray();
6968
}
7069
}

src/Strategies/Responses/UseResponseTag.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
use Illuminate\Routing\Route;
66
use Mpociot\Reflection\DocBlock;
7-
use Illuminate\Http\JsonResponse;
87
use Mpociot\Reflection\DocBlock\Tag;
98
use Mpociot\ApiDoc\Strategies\Strategy;
109
use Mpociot\ApiDoc\Tools\RouteDocBlocker;
@@ -63,6 +62,6 @@ protected function getDocBlockResponses(array $tags)
6362
}, $responseTags);
6463

6564
// Convert responses to [200 => 'response', 401 => 'response']
66-
return collect($responses)->pluck("0", "1")->toArray();
65+
return collect($responses)->pluck('0', '1')->toArray();
6766
}
6867
}

src/Tools/Generator.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public function processRoute(Route $route, array $rulesToApply = [])
5454
$method = $controller->getMethod($methodName);
5555

5656
$parsedRoute = [
57-
'id' => md5($this->getUri($route) . ':' . implode($this->getMethods($route))),
57+
'id' => md5($this->getUri($route).':'.implode($this->getMethods($route))),
5858
'methods' => $this->getMethods($route),
5959
'uri' => $this->getUri($route),
6060
'boundUri' => Utils::getFullUrl($route, $rulesToApply['bindings'] ?? ($rulesToApply['response_calls']['bindings'] ?? [])),
@@ -71,7 +71,7 @@ public function processRoute(Route $route, array $rulesToApply = [])
7171

7272
$responses = $this->fetchResponses($controller, $method, $route, $rulesToApply, $parsedRoute);
7373
$parsedRoute['response'] = $responses;
74-
$parsedRoute['showresponse'] = !empty($responses);
74+
$parsedRoute['showresponse'] = ! empty($responses);
7575

7676
$parsedRoute['headers'] = $rulesToApply['headers'] ?? [];
7777

@@ -91,6 +91,7 @@ protected function fetchMetadata(ReflectionClass $controller, ReflectionMethod $
9191
'description' => '',
9292
'authenticated' => false,
9393
];
94+
9495
return $this->iterateThroughStrategies('metadata', $context, [$route, $controller, $method, $rulesToApply]);
9596
}
9697

@@ -127,7 +128,7 @@ protected function iterateThroughStrategies(string $key, array $context, array $
127128
$strategy = new $strategyClass($this->config);
128129
$arguments[] = $context;
129130
$results = $strategy(...$arguments);
130-
if (!is_null($results)) {
131+
if (! is_null($results)) {
131132
foreach ($results as $index => $item) {
132133
// Using a for loop rather than array_merge or +=
133134
// so it does not renumber numeric keys
@@ -142,6 +143,7 @@ protected function iterateThroughStrategies(string $key, array $context, array $
142143
}
143144
}
144145
}
146+
145147
return $context[$key];
146148
}
147149

tests/Unit/LaravelGeneratorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public function createRoute(string $httpMethod, string $path, string $controller
2828
public function createRouteUsesArray(string $httpMethod, string $path, string $controllerMethod, $register = false, $class = TestController::class)
2929
{
3030
if ($register) {
31-
return RouteFacade::{$httpMethod}($path, [$class. "$controllerMethod"]);
31+
return RouteFacade::{$httpMethod}($path, [$class."$controllerMethod"]);
3232
} else {
3333
return new Route([$httpMethod], $path, ['uses' => [$class, $controllerMethod]]);
3434
}

0 commit comments

Comments
 (0)