77use ReflectionException ;
88use Illuminate \Routing \Route ;
99use Illuminate \Console \Command ;
10+ use Mpociot \ApiDoc \Tools \Utils ;
1011use Mpociot \Reflection \DocBlock ;
1112use Illuminate \Support \Collection ;
1213use Illuminate \Support \Facades \URL ;
@@ -217,7 +218,7 @@ private function processRoutes(Generator $generator, array $routes)
217218 foreach ($ routes as $ routeItem ) {
218219 $ route = $ routeItem ['route ' ];
219220 /** @var Route $route */
220- if ($ this ->isValidRoute ($ route ) && $ this ->isRouteVisibleForDocumentation ($ route ->getAction ()[ ' uses ' ] )) {
221+ if ($ this ->isValidRoute ($ route ) && $ this ->isRouteVisibleForDocumentation ($ route ->getAction ())) {
221222 $ parsedRoutes [] = $ generator ->processRoute ($ route , $ routeItem ['apply ' ]);
222223 $ this ->info ('Processed route: [ ' .implode (', ' , $ generator ->getMethods ($ route )).'] ' .$ generator ->getUri ($ route ));
223224 } else {
@@ -235,19 +236,24 @@ private function processRoutes(Generator $generator, array $routes)
235236 */
236237 private function isValidRoute (Route $ route )
237238 {
238- return ! is_callable ($ route ->getAction ()['uses ' ]) && ! is_null ($ route ->getAction ()['uses ' ]);
239+ $ action = Utils::getRouteActionUses ($ route ->getAction ());
240+ if (is_array ($ action )) {
241+ $ action = implode ('@ ' , $ action );
242+ }
243+
244+ return ! is_callable ($ action ) && ! is_null ($ action );
239245 }
240246
241247 /**
242- * @param $route
248+ * @param $action
243249 *
244250 * @throws ReflectionException
245251 *
246252 * @return bool
247253 */
248- private function isRouteVisibleForDocumentation ($ route )
254+ private function isRouteVisibleForDocumentation ($ action )
249255 {
250- list ($ class , $ method ) = explode ( ' @ ' , $ route );
256+ list ($ class , $ method ) = Utils:: getRouteActionUses ( $ action );
251257 $ reflection = new ReflectionClass ($ class );
252258
253259 if (! $ reflection ->hasMethod ($ method )) {
@@ -260,7 +266,7 @@ private function isRouteVisibleForDocumentation($route)
260266 $ phpdoc = new DocBlock ($ comment );
261267
262268 return collect ($ phpdoc ->getTags ())
263- ->filter (function ($ tag ) use ($ route ) {
269+ ->filter (function ($ tag ) use ($ action ) {
264270 return $ tag ->getName () === 'hideFromAPIDocumentation ' ;
265271 })
266272 ->isEmpty ();
0 commit comments