66use ReflectionException ;
77use Illuminate \Routing \Route ;
88use Illuminate \Console \Command ;
9+ use Mpociot \ApiDoc \Tools \Utils ;
910use Mpociot \Reflection \DocBlock ;
1011use Illuminate \Support \Collection ;
1112use Illuminate \Support \Facades \URL ;
@@ -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,19 +226,24 @@ private function processRoutes(Generator $generator, array $routes)
225226 */
226227 private function isValidRoute (Route $ route )
227228 {
228- return ! is_callable ($ route ->getAction ()['uses ' ]) && ! is_null ($ route ->getAction ()['uses ' ]);
229+ $ action = Utils::getRouteActionUses ($ route ->getAction ());
230+ if (is_array ($ action )) {
231+ $ action = implode ('@ ' , $ action );
232+ }
233+
234+ return ! is_callable ($ action ) && ! is_null ($ action );
229235 }
230236
231237 /**
232- * @param $route
238+ * @param $action
233239 *
234240 * @throws ReflectionException
235241 *
236242 * @return bool
237243 */
238- private function isRouteVisibleForDocumentation ($ route )
244+ private function isRouteVisibleForDocumentation ($ action )
239245 {
240- list ($ class , $ method ) = explode ( ' @ ' , $ route );
246+ list ($ class , $ method ) = Utils:: getRouteActionUses ( $ action );
241247 $ reflection = new ReflectionClass ($ class );
242248
243249 if (! $ reflection ->hasMethod ($ method )) {
@@ -250,7 +256,7 @@ private function isRouteVisibleForDocumentation($route)
250256 $ phpdoc = new DocBlock ($ comment );
251257
252258 return collect ($ phpdoc ->getTags ())
253- ->filter (function ($ tag ) use ($ route ) {
259+ ->filter (function ($ tag ) use ($ action ) {
254260 return $ tag ->getName () === 'hideFromAPIDocumentation ' ;
255261 })
256262 ->isEmpty ();
0 commit comments