protected function ControllerResolver::createController

Same name in this branch

Returns a callable for the given controller.

Parameters

string $controller A Controller string:

Return value

mixed A PHP callable

Throws

\InvalidArgumentException

1 call to ControllerResolver::createController()
1 method overrides ControllerResolver::createController()

File

drupal/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Controller/ControllerResolver.php, line 150

Class

ControllerResolver
ControllerResolver.

Namespace

Symfony\Component\HttpKernel\Controller

Code

protected function createController($controller) {
  if (false === strpos($controller, '::')) {
    throw new \InvalidArgumentException(sprintf('Unable to find controller "%s".', $controller));
  }
  list($class, $method) = explode('::', $controller, 2);
  if (!class_exists($class)) {
    throw new \InvalidArgumentException(sprintf('Class "%s" does not exist.', $class));
  }
  return array(
    new $class(),
    $method,
  );
}