protected function ArgumentsResolver::getReflector

protected ArgumentsResolver::getReflector(callable $callable)

Gets a reflector for the access check callable.

The access checker may be either a procedural function (in which case the callable is the function name) or a method (in which case the callable is an array of the object and method name).

Parameters

callable $callable: The callable (either a function or a method).

Return value

\ReflectionFunctionAbstract The ReflectionMethod or ReflectionFunction to introspect the callable.

File

core/lib/Drupal/Component/Utility/ArgumentsResolver.php, line 120

Class

ArgumentsResolver
Resolves the arguments to pass to a callable.

Namespace

Drupal\Component\Utility

Code

protected function getReflector(callable $callable) {
  return is_array($callable) ? new \ReflectionMethod($callable[0], $callable[1]) : new \ReflectionFunction($callable);
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Component!Utility!ArgumentsResolver.php/function/ArgumentsResolver::getReflector/8.1.x