protected function ControllerResolver::createController
protected ControllerResolver::createController($controller)
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
File
- core/lib/Drupal/Core/Controller/ControllerResolver.php, line 109
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); } // Controller in the class::method notation. 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); }
© 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!Core!Controller!ControllerResolver.php/function/ControllerResolver::createController/8.1.x