protected function ControllerResolver::createController in Zircon Profile 8.0
Same name in this branch
- 8.0 vendor/symfony/http-kernel/Controller/ControllerResolver.php \Symfony\Component\HttpKernel\Controller\ControllerResolver::createController()
- 8.0 core/lib/Drupal/Core/Controller/ControllerResolver.php \Drupal\Core\Controller\ControllerResolver::createController()
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/Controller/ControllerResolver.php \Drupal\Core\Controller\ControllerResolver::createController()
Returns a callable for the given controller.
Parameters
string $controller: A Controller string.
Return value
mixed A PHP callable.
Throws
\LogicException If the controller cannot be parsed.
\InvalidArgumentException If the controller class does not exist.
Overrides ControllerResolver::createController
1 call to ControllerResolver::createController()
- ControllerResolver::getControllerFromDefinition in core/
lib/ Drupal/ Core/ Controller/ ControllerResolver.php - Returns the Controller instance with a given controller route definition.
File
- core/
lib/ Drupal/ Core/ Controller/ ControllerResolver.php, line 115 - Contains \Drupal\Core\Controller\ControllerResolver.
Class
- ControllerResolver
- ControllerResolver to enhance controllers beyond Symfony's basic handling.
Namespace
Drupal\Core\ControllerCode
protected function createController($controller) {
// Controller in the service:method notation.
$count = substr_count($controller, ':');
if ($count == 1) {
list($class_or_service, $method) = explode(':', $controller, 2);
}
elseif (strpos($controller, '::') !== FALSE) {
list($class_or_service, $method) = explode('::', $controller, 2);
}
else {
throw new \LogicException(sprintf('Unable to parse the controller name "%s".', $controller));
}
$controller = $this->classResolver
->getInstanceFromDefinition($class_or_service);
return array(
$controller,
$method,
);
}