The controller entry point.

@return string
@throws Exception
@throws oxConnectionException
@throws oxSystemComponentException
335666
public function render()
    {
        //If ERP mode is enabled do nothing, if IPN or CRON authorize unauthorized orders
        if ($this->_getContainer()->getConfig()->getConfigParam('blAmazonERP') === true) {
            return $this->_processError('IPN response handling disabled - ERP mode is ON (Module settings)');
        }

        //Check if IPN response handling is turned ON
        if ($this->_getContainer()->getConfig()->getConfigParam('sAmazonAuthorize') !== 'IPN') {
            return $this->_processError('IPN response handling disabled (Module settings)');
        }

        //Get SNS message
        $sBody = file_get_contents($this->_sInput);

        if ($sBody === '') {
            return $this->_processError('SNS message empty or Error while reading SNS message occurred');
        }

        //Perform IPN action
        if ($this->_getContainer()->getIpnHandler()->processIPNAction($sBody) !== true) {
            return $this->_processError('Error while handling Amazon response');
        }

        return $this->_sThisTemplate;
    }
1328117
protected function getControllerInstance()
    {
        // One-time instantiation of an extended controller object
        if ($this->controllerInstance === null) {
            $extendedControllerClassName = $this->extbaseController.'ComponentController_'.md5(
                    $this->extbaseControllerClass
                );

            // One-off class declaration
            if (!class_exists($extendedControllerClassName, false)) {
                $extendedControllerPhp = 'class '.$extendedControllerClassName.' extends '.$this->extbaseControllerClass;
                $extendedControllerPhp .= ' implements '.ComponentControllerInterface::class;
                $extendedControllerPhp .= ' { use '.ComponentControllerTrait::class.'; }';
                eval($extendedControllerPhp);
            }

            $this->controllerInstance = $this->objectManager->get($extendedControllerClassName);
        }

        $settings = $this->controllerSettings ?: [];

        return $this->controllerInstance->setSettings($settings);
    }
980669
public function getController()
    {
        if (! $this->controller) {
            $class = $this->parseControllerCallback()[0];

            $this->controller = $this->container->make(ltrim($class, '\\'));
        }

        return $this->controller;
    }
471524
public function process()
    {
        // Your controller name
        $this->controller = Inflector::classify($this->argument('name')).'Controller';

        // By default we will generate basic controller, if resource set then we will generate
        // REST-ful Resource controller
        $this->setControllerType();

        try {
            $this->makeController();
        } catch (\Exception $e) {
            throw $e;
        }

        $this->info('Controller '.$this->controller.' Generated Successfully By Cygnite Cli.');
    }
100564
public function execute()
    {
        try {
            // @ prepare hook
            $this->prepareExecute();

            // @ before event
            $this->triggerEvent('onControllerBeforeExecute', [
                'controller' => $this
            ]);

            // Prepare the last middleware, the last middleware is the real logic of this controller self.
            $chain = $this->getMiddlewareChain()->setEndMiddleware(function () {
                return $this->container->call([$this, 'doExecute'], [], $this);
            });

            // Do execute, run middlewares.
            $result = $chain->execute(new ControllerData(get_object_vars($this)));

            // @ post hook
            $result = $this->postExecute($result);

            // @ post event
            $this->triggerEvent('onControllerAfterExecute', [
                'controller' => $this,
                'result' => &$result,
            ]);
        } catch (ValidateFailException $e) {
            return $this->processFailure($e);
        } catch (\Exception $e) {
            // You can do some error handling in processFailure(), for example: rollback the transaction.
            $result = $this->processFailure($e);

            if (!$this->app->get('system.debug')) {
                return $result;
            }

            throw $e;
        } catch (\Throwable $t) {
            // You can do some error handling in processFailure(), for example: rollback the transaction.
            $this->processFailure(new \ErrorException(
                $t->getMessage(),
                $t->getCode(),
                E_ERROR,
                $t->getFile(),
                $t->getLine(),
                $t
            ));

            throw $t;
        }

        if ($result === false) {
            // You can do some error handling in processFailure(), for example: rollback the transaction.
            return $this->processFailure(new \Exception('Unknown Error'));
        }

        // Now we return result to package that it will handle response.
        return $this->processSuccess($result);
    }
1274600
public function actionView()
    {
        if (!$this->actionView) {
            $this->actionView = new ActionView();
            
            # TODO: add default helpers.
            # make sure namespaced controllers get namespaced helpers added.
            HelperSet::addDefaultHelper('ApplicationHelper');
            
            $this->actionView->setHelperSet(
                new HelperSet(
                    $this->request(),
                    $this->params(),
                    $this->session(),
                    $this->assigns()
                )
            );
            # Set routeSet to baseHelper.
            $this->actionView->helperSet()->setRouteSet($this->routeSet());
            
        }
        return $this->actionView;
    }
1027238
public function instantiate()
    {
        $view = new ViewPhpService($this->app->getAppDir().'/'.self::TEMPLATES_DIR.'/');

        $view->setHelper(
            'inc',
            function ($templates, array $data = array()) use ($view) {
                return $view->render($templates, $data);
            }
        )->setHelper(
            'exe',
            function ($controller, $action, array $get = array()) {
                $request = new VirtualRequest($controller, $action, $get);

                return $this->app->getControllerDispatcher()->dispatch($request)->getContent();
            }
        )->setHelper(
            'url',
            function ($controller, $action, array $args = array(), array $get = array()) {
                return $this->app->getRouter()->buildUrl($controller, $action, $args, $get);
            }
        );

        return $view;
    }
576120
public function dispatch()
    {
        $match = $this->match();

        if (class_exists($this->_controller_classname)) {
            $controller = $this->_controller_classname;
        } else {
            Cordillera::$exception = new Exception(
                translate('%s not found', [$this->_controller_classname]),
                500,
                Exception::ERROR
            );
            $controller = 'cordillera\\middlewares\\Controller';
        }

        $this->handler = '';

        if (isset($match['friendly']) && !$match['friendly']) {
            $this->handler = $match['handler'] ? $match['handler'] : $this->_default_route;
        } elseif (isset($match['friendly']) && $match['friendly']) {
            $this->handler = $match['handler'];
            $_GET = array_merge($_GET, $match['params']);
        } elseif (!isset($match['friendly'])) {
            $this->handler = ($match != '/' && $match != '') ? $match : $this->_default_route;
        }

        return new $controller($this);
    }
679532
public function getCurrentAction()
    {
        if (! isset($this->actions[$this->position])) return null;

        $define = $this->actions[$this->position];
        if ($define['controller']) return $define;

        $controller = $this->getController($define['controller_name']);
        $define['controller'] = $controller;

        $this->actions[$this->position] = $define;

        return $define;
    }
59991
public function execute()
    {
        if (is_string($this->callback)) {
            // Will call the controller here
            $parts = explode('::', $this->callback);
            $className = $parts[0];
            $classMethod = $parts[1];

            if (! class_exists($className)) {
                throw new RouterException("The callback class declared in your middleware is not found: '{$className}'");
            }

            $class = new $className();

            if (! $class instanceof BaseMiddleware) {
                throw new RouterException("The class in your middleware route doesn't extend the BaseMiddleware: '{$className}'"); // @codeCoverageIgnore
            }

            if (! method_exists($class, $classMethod)) {
                throw new RouterException("The class in your middleware route doesn't have the method you provided: '{$className}' method: {$classMethod}");
            }

            // Call the method. Catch return
            $result = call_user_func(array($class, $classMethod));

        } elseif (is_callable($this->callback)) {
            $result = call_user_func($this->callback);

        } else {
            throw new RouterException("Middleware callback is not a class or callable!"); // @codeCoverageIgnore
        }

        // See if we got a boolean back.
        if ($result === false && $this->position === 'before') {
            // We should stop!
            return false;
        }
        return true;
    }
470359
protected function getStartControllerKey()
    {
        $controllerKey = Registry::getConfig()->getRequestControllerId();

        // Use default route in case no controller id is given
        if (!$controllerKey) {
            $session = \OxidEsales\Eshop\Core\Registry::getSession();
            if ($this->isAdmin()) {
                $controllerKey = $session->getVariable("auth") ? 'admin_start' : 'login';
            } else {
                $controllerKey = $this->getFrontendStartControllerKey();
            }
            $session->setVariable('cl', $controllerKey);
        }

        return $controllerKey;
    }
1217798
public String getController() {
        final StringBuilder controller = new StringBuilder();
        if (getProtocol() != null) {
            controller.append(getProtocol()).append("://");
        }
        if (getHost() != null) {
            controller.append(getHost());
        } else {
            controller.append("localhost");
        }
        if (getPort() > 0) {
            controller.append(':').append(getPort());
        }
        return controller.toString();
    }
909716
public function getPath()
    {
        return $this->getBasePath() . '/' . parent::getConfigGeneratorClassPath($this->getPathConfigNode(), true) . '/' . $this->getControllerName() . 'Controller.php';
    }
20658
public function controllerName() {
        $request = $this->stack->getCurrentRequest();
        if ($request instanceof Request) {
            $string = $request->get('_controller');
            $parts = explode('::', $string);
            $controller = $parts[0];
            $pattern = "#Controller\\\([a-zA-Z\\\]*)Controller#";
            $matches = array();
            preg_match($pattern, $controller, $matches);
            if (isset($matches[1])) {
                return strtolower(str_replace('\\', '_', $matches[1]));
            }

            return '';
        }

        return '';
    }
203004
public function startup()
    {
        if (!$this->request->is('post') || !$this->_actionCheck()) {
            return null;
        }

        list($url) = explode('?', $this->request->getRequestTarget());

        $params = $this->_filterParams();
        if ($params) {
            $url .= '?' . http_build_query($params);
        }

        return $this->_registry->getController()->redirect($url);
    }
489879
protected function createAction()
    {
        if (strtolower($this->option('type')) == 'regular' || $this->option('type') == null) {
            return $this->createView();
        }
        if (strtolower($this->option('type')) == 'controller') {
            return $this->createController();
        }
        return $this->createResourceController();
    }
1323128
public static function dispatch() {
        self::$_config = MRest::getConfig('routing');

        $routeData = self::_callDispatcher(self::$_config['dispatcher']);

        if (!class_exists($routeData['class']) || !(new \ReflectionClass($routeData['class']))->isInstantiable()) {
            throw new \Exception('Application class [' . $routeData['class'] . '] was not found', 404);
        }
        $class = new $routeData['class']();

        if (!is_callable([$class, $routeData['method']])) {
            throw new \Exception('Method [' . $routeData['method'] . '] not allowed', 405);
        }

        return call_user_func_array([$class, $routeData['method']], $routeData['attributes']);
    }