22
33namespace Mpociot \ApiDoc \Commands ;
44
5+ use Mpociot \ApiDoc \Tools \Utils ;
56use ReflectionClass ;
67use ReflectionException ;
78use Illuminate \Routing \Route ;
@@ -207,7 +208,7 @@ private function processRoutes(Generator $generator, array $routes)
207208 foreach ($ routes as $ routeItem ) {
208209 $ route = $ routeItem ['route ' ];
209210 /** @var Route $route */
210- if ($ this ->isValidRoute ($ route ) && $ this ->isRouteVisibleForDocumentation ($ route ->getAction ()[ ' uses ' ] )) {
211+ if ($ this ->isValidRoute ($ route ) && $ this ->isRouteVisibleForDocumentation ($ route ->getAction ())) {
211212 $ parsedRoutes [] = $ generator ->processRoute ($ route , $ routeItem ['apply ' ]);
212213 $ this ->info ('Processed route: [ ' .implode (', ' , $ generator ->getMethods ($ route )).'] ' .$ generator ->getUri ($ route ));
213214 } else {
@@ -225,7 +226,7 @@ private function processRoutes(Generator $generator, array $routes)
225226 */
226227 private function isValidRoute (Route $ route )
227228 {
228- $ action = $ route ->getAction ()[ ' uses ' ] ;
229+ $ action = Utils:: getRouteActionUses ( $ route ->getAction ()) ;
229230 if (is_array ($ action )) {
230231 $ action = implode ('@ ' , $ action );
231232 }
@@ -234,15 +235,15 @@ private function isValidRoute(Route $route)
234235 }
235236
236237 /**
237- * @param $route
238- *
239- * @throws ReflectionException
238+ * @param $action
240239 *
241240 * @return bool
241+ *@throws ReflectionException
242+ *
242243 */
243- private function isRouteVisibleForDocumentation ($ route )
244+ private function isRouteVisibleForDocumentation ($ action )
244245 {
245- list ($ class , $ method ) = is_array ( $ route ) ? $ route : explode ( ' @ ' , $ route );
246+ list ($ class , $ method ) = Utils:: getRouteActionUses ( $ action );
246247 $ reflection = new ReflectionClass ($ class );
247248
248249 if (! $ reflection ->hasMethod ($ method )) {
@@ -255,7 +256,7 @@ private function isRouteVisibleForDocumentation($route)
255256 $ phpdoc = new DocBlock ($ comment );
256257
257258 return collect ($ phpdoc ->getTags ())
258- ->filter (function ($ tag ) use ($ route ) {
259+ ->filter (function ($ tag ) use ($ action ) {
259260 return $ tag ->getName () === 'hideFromAPIDocumentation ' ;
260261 })
261262 ->isEmpty ();
0 commit comments