protected function createControllerInstance($controllerName, $actionId = null, $config = [])
    {
        if (!isset($controllerName)) {
            return [null, $actionId];
        } elseif ($controllerName instanceof ControllerInterface) {
            $controller = $controllerName;
            if (!isset($actionId) || !$controller->hasAction($actionId)) {
                $actionId = $controller->defaultAction;
            }
            return [$controller, $actionId];
        }
        $controller = null;
        foreach ($this->controllerNamespaces as $namespace) {
            $controllerNameFull = $namespace . '\\' . $controllerName;
            if (!class_exists($controllerNameFull)) {
                continue;
            }
            try {
                /** @var ControllerInterface $controller */
                $config = Reaction\Helpers\ArrayHelper::merge($config, ['class' => $controllerNameFull]);
                $controller = Reaction::create($config);
                if (!isset($actionId) || !$controller->hasAction($actionId)) {
                    $actionId = $controller->defaultAction;
                }
                break;
            } catch (InvalidConfigException $exception) {
                $controller = null;
                continue;
            }
        }
        return [$controller, $actionId];
    }
protected function createControllerInstance($controllerName, $actionId = null, $config = [])
    {
        if (!isset($controllerName)) {
            return [null, $actionId];
        } elseif ($controllerName instanceof ControllerInterface) {
            $controller = $controllerName;
            if (!isset($actionId) || !$controller->hasAction($actionId)) {
                $actionId = $controller->defaultAction;
            }
            return [$controller, $actionId];
        }
        $controller = null;
        foreach ($this->controllerNamespaces as $namespace) {
            $controllerNameFull = $namespace . '\\' . $controllerName;
            if (!class_exists($controllerNameFull)) {
                continue;
            }
            try {
                /** @var ControllerInterface $controller */
                $config = Reaction\Helpers\ArrayHelper::merge($config, ['class' => $controllerNameFull]);
                $controller = Reaction::create($config);
                if (!isset($actionId) || !$controller->hasAction($actionId)) {
                    $actionId = $controller->defaultAction;
                }
                break;
            } catch (InvalidConfigException $exception) {
                $controller = null;
                continue;
            }
        }
        return [$controller, $actionId];
    }
protected function createControllerInstance ( $ controllerName , $ actionId = null , $ config = [ ] ) { if ( ! isset ( $ controllerName ) ) { return [ null , $ actionId ] ; } elseif ( $ controllerName instanceof ControllerInterface ) { $ controller = $ controllerName ; if ( ! isset ( $ actionId ) || ! $ controller -> hasAction ( $ actionId ) ) { $ actionId = $ controller -> defaultAction ; } return [ $ controller , $ actionId ] ; } $ controller = null ; foreach ( $ this -> controllerNamespaces as $ namespace ) { $ controllerNameFull = $ namespace . '\\' . $ controllerName ; if ( ! class_exists ( $ controllerNameFull ) ) { continue ; } try { /** @var ControllerInterface $controller */ $ config = Reaction \ Helpers \ ArrayHelper :: merge ( $ config , [ 'class' => $ controllerNameFull ] ) ; $ controller = Reaction :: create ( $ config ) ; if ( ! isset ( $ actionId ) || ! $ controller -> hasAction ( $ actionId ) ) { $ actionId = $ controller -> defaultAction ; } break ; } catch ( InvalidConfigException $ exception ) { $ controller = null ; continue ; } } return [ $ controller , $ actionId ] ; }
Search controller by name and action ID
@param string|ControllerInterface $controllerName
@param string                     $actionId
@param array                      $config
@return array
Search controller by name and action ID