protected function createController($controller)
    {
        if (false === strpos($controller, '::')) {
            $count = substr_count($controller, ':');
            if (2 == $count && $this->parser) {
                // controller in the a:b:c notation then
                $controller = $this->parser->parse($controller);
            }
            else if (1 == $count) {
                // controller in the service:method notation
                list($service, $method) = explode(':', $controller, 2);
                return array($this->container->get($service), $method);
            }
            else if ($this->container->has($controller) && method_exists($service = $this->container->get($controller), '__invoke')) {
                return $service;
            }
            else {
                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));
        }

        $controller = $this->instantiateController($class);

        return array($controller, $method);
    }
protected function createController($controller)
    {
        if (false === strpos($controller, '::')) {
            $count = substr_count($controller, ':');
            if (2 == $count && $this->parser) {
                // controller in the a:b:c notation then
                $controller = $this->parser->parse($controller);
            }
            else if (1 == $count) {
                // controller in the service:method notation
                list($service, $method) = explode(':', $controller, 2);
                return array($this->container->get($service), $method);
            }
            else if ($this->container->has($controller) && method_exists($service = $this->container->get($controller), '__invoke')) {
                return $service;
            }
            else {
                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));
        }

        $controller = $this->instantiateController($class);

        return array($controller, $method);
    }
protected function createController ( $ controller ) { if ( false === strpos ( $ controller , '::' ) ) { $ count = substr_count ( $ controller , ':' ) ; if ( 2 == $ count && $ this -> parser ) { // controller in the a:b:c notation then $ controller = $ this -> parser -> parse ( $ controller ) ; } else if ( 1 == $ count ) { // controller in the service:method notation list ( $ service , $ method ) = explode ( ':' , $ controller , 2 ) ; return array ( $ this -> container -> get ( $ service ) , $ method ) ; } else if ( $ this -> container -> has ( $ controller ) && method_exists ( $ service = $ this -> container -> get ( $ controller ) , '__invoke' ) ) { return $ service ; } else { 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 ) ) ; } $ controller = $ this -> instantiateController ( $ class ) ; return array ( $ controller , $ method ) ; }
Returns a callable for the given controller.

@param string $controller A Controller string

@return mixed A PHP callable

@throws \InvalidArgumentException
Returns a callable for the given controller .