routing with cron
@access private
@param $src        string
@param $controller string
@param $action     string
@return void
@since 3.0
@package Gcs\Framework\Core\Engine
7297
private function _routeCron($src, $controller, $action) {
        $this->request->name = '-' . $src . '_' . $controller . '_' . $action;
        $this->request->src = $src;
        $this->request->controller = $controller;
        $this->request->action = $action;
        $this->request->auth = new Auth($this->request->src);
        $this->_route = true;
    }
741006
public function onKernelController(FilterControllerEvent $event): void
    {
        $controller = $event->getController();
        if (\is_array($controller)) {
            [$controller] = $controller; // Ignoring action
        }
        if (!$controller instanceof AdminInjectableInterface && !$controller instanceof ActionInjectableInterface) {
            return;
        }

        $request = $event->getRequest();
        if (!$request->attributes->has('_admin')) {
            $routeName = $request->attributes->get('_route');

            $m = "Missing request attribute '_admin' for route {$routeName}, this means you declared";
            $m .= ' this route outside the admin configuration, please use the admin configuration';
            throw new \LogicException($m);
        }
        $admin = $request->attributes->get('_admin');
        if (!$admin instanceof Admin) {
            throw new \UnexpectedValueException('_admin request attribute is not an Admin object');
        }
        if ($controller instanceof AdminInjectableInterface) {
            $controller->setAdmin($admin);
        }

        if (!$request->attributes->has('_action')) {
            $routeName = $request->attributes->get('_route');

            $m = "Missing request attribute '_action' for route {$routeName},";
            $m .= 'this means you declared this route outside the admin configuration, please include the _action';
            $m .= 'attribute in your route definition or use the admin configuration';
            throw new \LogicException($m);
        }
        $admin->setCurrentAction($request->attributes->get('_action'));
        if ($controller instanceof ActionInjectableInterface) {
            $controller->setAction($admin->getCurrentAction());
        }
    }
1136337
protected function createRoute($methods, $uri, $action)
    {
        if (is_callable($action)) {
            $action = array('uses' => $action);
        }

        // If the route is routing to a controller we will parse the route action into
        // an acceptable array format before registering it and creating this route
        // instance itself. We need to build the Closure that will call this out.
        else if ($this->actionReferencesController($action)) {
            $action = $this->convertToControllerAction($action);
        }

        // If no "uses" property has been set, we will dig through the array to find a
        // Closure instance within this list. We will set the first Closure we come
        // across into the "uses" property that will get fired off by this route.
        else if (! isset($action['uses'])) {
            $action['uses'] = $this->findActionClosure($action);
        }

        if (isset($action['middleware']) && is_string($action['middleware'])) {
            $action['middleware'] = explode('|', $action['middleware']);
        }

        $route = $this->newRoute(
            $methods, $uri = $this->prefix($uri), $action
        );

        // If we have groups that need to be merged, we will merge them now after this
        // route has already been created and is ready to go. After we're done with
        // the merge we will be ready to return the route back out to the caller.
        if (! empty($this->groupStack)) {
            $this->mergeGroupAttributesIntoRoute($route);
        }

        $this->addWhereClausesToRoute($route);

        return $route;
    }
512185
public function saveToCache($controller, $action, $output){

		if(!$this->needCache()){

			$replaced = $this->makeReplace($output);

			return $replaced;
		}

		$name = $this->generateFileName($controller, $action);

		$path = Yii::getAlias('@webroot') . $this->getAssetsUrl() . DIRECTORY_SEPARATOR . $this->folder;
		$this->checkPermissionsOrCreate($path);

		$file = $path . DIRECTORY_SEPARATOR . $name;

		$fp = fopen($file, 'w');

		$replaced = $this->makeReplace($output);

		$output = str_replace(Yii::$app->request->getCsrfToken(), '{CSRF_TOKEN}', $output);


		if(!$fp){
			throw new Exception('Directory ' . $file . ' does not exists or does not have write permission');
		}

		fwrite($fp, $output);
		fclose($fp);

		Yii::$app->assetManager->publish(__DIR__ . DIRECTORY_SEPARATOR, true, 1);

		return $replaced;
	}
535339
public static function execute($controller, $request) {   
        switch($request->method()) { 
            case 'POST':
                $data = $controller->store($request->bodyRequest());
                KernelHttp::makeResponse('201', $data);
                break;
            case 'PUT':
                $data = $controller->update($request->bodyRequest());
                KernelHttp::makeResponse('200', $data);
                break;
            case 'DELETE':
                $controller->destroy($request->getInteractionsRequest());
                KernelHttp::makeResponse('200');
                break;
            default: 
                $request->getRequiredParameter() ? $data = $controller->show($request->getInteractionsRequest()) : $data = $controller->index($request->getInteractionsRequest()); 
                KernelHttp::makeResponse('200', $data);
                break;
        } 
    }
1058073
protected function setAddRoute($controller, $action): Controller
    {
        $callTo = Inflector::classify($controller) . '@' . $action;

        $this->routes['get'] = array_merge($this->routes['get'], [
            "/$controller/$action/" => $callTo,
        ]);

        $this->routes['post'] = [
            "/$controller/$action/" => $callTo,
        ];

        return $this;
    }
936285
protected function executeCliAction(Config\Action $action) : void
    {
        // since the cli has no straight way to communicate back to php
        // cli hooks have to handle sync stuff by them self
        // so no 'beforeAction' or 'afterAction' is called here
        $runner = new Action\Cli();
        $runner->execute($this->io, $action, $this->arguments);
    }
1007817
public static function get_previous_cron($controller,$action){
        return self::find()->where(['controller'=>$controller,'action'=>$action, 'success' => 1])->orderBy('id_cron_job DESC')->one();
    }
178989
public function onKernelController(ControllerEvent $event): void
    {
        if (!$this->check($event)) {
            return;
        }

        if ($annotation = $this->getAnnotation($event)) {
            $annotation->setData($this->getAttributes($event));
            /* @var $annotation Cache */
            $response = $this->getCache($annotation->getKey($event->getRequest()->get(self::ROUTE)));
            if (null !== $response) {
                $event->setController(function () use (
                    $response
                ) {
                    return $response;
                });
            }
        }
    }
731647
public function patch(string $uri, string $controller, string $action)
    {
        $this->addRoute('PATCH', $uri, $controller, $action);
    }
1180443
protected function actionRedirect($action)
    {
        if ($this->redirect)
        {
            return;
        }

        $this->redirect = $action->getAttribute('uri');
        /** @var TAdminUI $page */
        $page = Eresus_Kernel::app()->getPage();
        $this->redirect = $page->replaceMacros($this->redirect);
    }
582108
public function generate($controllerName, $action)
    {
        $this->route = new CallbackRoute();
        $this->route->addPossibilities(array($controllerName, $action));
        return array($this, "run");
    }
985110
protected function _parseAnnotationCron($src, $controller, $annotation) {
        foreach ($annotation['methods'] as $action => $annotationMethods) {
            foreach ($annotationMethods as $annotationMethod) {
                if ($annotationMethod['annotation'] == 'Cron') {
                    /** @var \Gcs\Framework\Core\Annotation\Annotations\Cron\Cron $annotation */
                    $annotation = $annotationMethod['instance'];

                    $key = '.' . $src . '.' . lcfirst(basename($controller, '.php')) . '.' . lcfirst(str_replace('action', '', $action));
                    $this->config['user']['cron']['task'][$key] = $annotation->time;
                }
            }
        }
    }
977268
public function exec_action($action)
    {
        if (isset($this->actions[$action])) {
            call_user_func($this->actions[$action]);
        }
        else if (rcube::get_instance()->action != 'refresh') {
            rcube::raise_error(array('code' => 524, 'type' => 'php',
                'file' => __FILE__, 'line' => __LINE__,
                'message' => "No handler found for action $action"), true, true);
        }
    }
898083
public function setController(Controller $controller)
    {
        $this->_Controller = $controller;
        $this->setEventManager($controller->getEventManager());
    }
875572
protected function _runFunction($action)
    {
        $controller = $this->_current['controller'];

        $path = $controller . '.' . $action . '.function';

        $function = Hash::get(self::$_data, $path);

        $this->_selected['action'] = $action;

        if ($function) {
            $function($this, $this->Controller);
        }
    }
1225016
public function beforeAction($action)
    {
        if (in_array($action->controller->id, $this->controllers)) {
            throw new NotFoundHttpException('Not found');
        }

        return true;
    }