|
@@ -2,6 +2,7 @@
|
|
|
|
|
|
namespace Knuckles\Scribe\GroupedEndpoints;
|
|
|
|
|
|
+use Illuminate\Routing\Route;
|
|
|
use Illuminate\Support\Arr;
|
|
|
use Illuminate\Support\Collection;
|
|
|
use Illuminate\Support\Str;
|
|
@@ -9,6 +10,7 @@ use Knuckles\Camel\Camel;
|
|
|
use Knuckles\Camel\Extraction\ExtractedEndpointData;
|
|
|
use Knuckles\Camel\Output\OutputEndpointData;
|
|
|
use Knuckles\Scribe\Commands\GenerateDocumentation;
|
|
|
+use Knuckles\Scribe\Exceptions\CouldntGetRouteDetails;
|
|
|
use Knuckles\Scribe\Extracting\ApiDetails;
|
|
|
use Knuckles\Scribe\Extracting\Extractor;
|
|
|
use Knuckles\Scribe\Matching\MatchedRoute;
|
|
@@ -102,7 +104,7 @@ class GroupedEndpointsFromApp implements GroupedEndpointsContract
|
|
|
$route = $routeItem->getRoute();
|
|
|
|
|
|
$routeControllerAndMethod = u::getRouteClassAndMethodNames($route);
|
|
|
- if (!$this->isValidRoute($routeControllerAndMethod)) {
|
|
|
+ if (!$this->isValidRoute($routeControllerAndMethod, $route)) {
|
|
|
c::warn('Skipping invalid route: ' . c::getRouteRepresentation($route));
|
|
|
continue;
|
|
|
}
|
|
@@ -217,9 +219,12 @@ class GroupedEndpointsFromApp implements GroupedEndpointsContract
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private function isValidRoute(array $routeControllerAndMethod = null): bool
|
|
|
+ private function isValidRoute(?array $routeControllerAndMethod, Route $route): bool
|
|
|
{
|
|
|
if (is_array($routeControllerAndMethod)) {
|
|
|
+ if (count($routeControllerAndMethod) < 2) {
|
|
|
+ throw CouldntGetRouteDetails::forRoute(c::getRouteRepresentation($route));
|
|
|
+ }
|
|
|
[$classOrObject, $method] = $routeControllerAndMethod;
|
|
|
if (u::isInvokableObject($classOrObject)) {
|
|
|
return true;
|