You are here

public function ControllerResolver::getArguments in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/http-kernel/Controller/ControllerResolver.php \Symfony\Component\HttpKernel\Controller\ControllerResolver::getArguments()

Returns the arguments to pass to the controller.

Parameters

Request $request A Request instance:

callable $controller A PHP callable:

Return value

array An array of arguments to pass to the controller

Throws

\RuntimeException When value for argument given is not provided

Overrides ControllerResolverInterface::getArguments

File

vendor/symfony/http-kernel/Controller/ControllerResolver.php, line 88

Class

ControllerResolver
ControllerResolver.

Namespace

Symfony\Component\HttpKernel\Controller

Code

public function getArguments(Request $request, $controller) {
  if (is_array($controller)) {
    $r = new \ReflectionMethod($controller[0], $controller[1]);
  }
  elseif (is_object($controller) && !$controller instanceof \Closure) {
    $r = new \ReflectionObject($controller);
    $r = $r
      ->getMethod('__invoke');
  }
  else {
    $r = new \ReflectionFunction($controller);
  }
  return $this
    ->doGetArguments($request, $controller, $r
    ->getParameters());
}