Skip to content

Commit

Permalink
fixing
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Oct 27, 2020
1 parent 25a1d76 commit 11cfa4d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 41 deletions.
19 changes: 2 additions & 17 deletions src/Illuminate/Routing/RouteAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public static function parse($uri, $action)
// If the action is already a Closure instance, we will just set that instance
// as the "uses" property, because there is nothing else we need to do when
// it is available. Otherwise we will need to find it in the action list.
if (static::isCallable($action)) {
if (Reflector::isCallable($action, true)) {
return ! is_array($action) ? ['uses' => $action] : [
'uses' => $action[0].'@'.$action[1],
'controller' => $action[0].'@'.$action[1],
Expand Down Expand Up @@ -74,25 +74,10 @@ protected static function missingAction($uri)
protected static function findCallable(array $action)
{
return Arr::first($action, function ($value, $key) {
return static::isCallable($value) && is_numeric($key);
return Reflector::isCallable($value) && is_numeric($key);
});
}

/**
* Determine if the given action is callable as a route.
*
* @param mixed $action
* @return bool
*/
public static function isCallable($action)
{
if (! is_array($action)) {
return is_callable($action);
}

return isset($action[0], $action[1]) && is_string($action[0]) && is_string($action[1]) && Reflector::isMethodCallable($action[0], $action[1]);
}

/**
* Make an action for an invokable controller.
*
Expand Down
24 changes: 0 additions & 24 deletions src/Illuminate/Support/Reflector.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,28 +52,4 @@ public static function isParameterSubclassOf($parameter, $className)
? (new ReflectionClass($paramClassName))->isSubclassOf($className)
: false;
}

/**
* Determine if the class method is callable.
*
* @param string $class
* @param string $method
* @return bool
*/
public static function isMethodCallable($class, $method)
{
if (! class_exists($class)) {
return false;
}

if (method_exists($class, $method)) {
return (new ReflectionMethod($class, $method))->isPublic();
}

if (method_exists($class, '__call')) {
return (new ReflectionMethod($class, '__call'))->isPublic();
}

return false;
}
}

0 comments on commit 11cfa4d

Please sign in to comment.