@param \ManaPHP\Rest\Controller $controller
@param string                   $action
@param array                    $params

@return mixed
168059
public function invokeAction($controller, $action, $params)
    {
        $actionMethod = $action . 'Action';

        if (!method_exists($controller, $actionMethod)) {
            throw new NotFoundActionException([
                '`:controller:::action` method does not exist',
                'action' => $actionMethod,
                'controller' => get_class($controller)
            ]);
        }

        $this->eventsManager->fireEvent('request:authorize', $this);

        $this->eventsManager->fireEvent('request:validate', $this, ['controller' => get_class($controller), 'action' => $action]);

        $this->eventsManager->fireEvent('request:ready', $this);

        $this->eventsManager->fireEvent('request:invoke', $this, $action);

        $args = $this->_buildActionArgs($controller, $action, $params);

        switch (count($args)) {
            case 0:
                $r = $controller->$actionMethod();
                break;
            case 1:
                $r = $controller->$actionMethod($args[0]);
                break;
            case 2:
                $r = $controller->$actionMethod($args[0], $args[1]);
                break;
            case 3:
                $r = $controller->$actionMethod($args[0], $args[1], $args[2]);
                break;
            default:
                $r = call_user_func_array([$controller, $actionMethod], $args);
                break;
        }

        $this->eventsManager->fireEvent('request:invoked', $this, ['action' => $action, 'return' => $r]);

        return $r;
    }
893764
protected function buildFormParams(array $params, $action)
    {
        $params = $this->addCommonParams($params, $action);

        return $this->addSignature($params);
    }
814998
public static function get_cron($controller,$action){
        $cron = self::find()->where(['controller'=>$controller,'action'=>$action, 'success' => 0])->orderBy('id_cron_job DESC')->one();
        if (is_null($cron)){
            $cron = new CronJob();
            $cron->controller = $controller;
            $cron->action = $action;
        }
        return $cron;
    }
592415
public function goToAction($action, $params = [])
    {
        return $this->request->goToPage($this->getName(), $action, $params);
    }
265202
public Api getActionResult(String action, String params) throws Exception {
    Api result = this.getActionResult(action, params, null, null);
    return result;
  }
542518
public function excludeActions($controller, $action){
		$cid = $controller->id;
		$action = is_array($action) ? $action : array($action);

		if(!isset($this->excluded_actions[$cid])){
			$this->excluded_actions[$cid] = array();
		}

		foreach($action as $a){
			if(in_array($a, $this->excluded_actions[$cid])){
				continue;
			}

			$this->excluded_actions[$cid][] = $a;
		}

		return $this;
	}
66250
public function load(Action $action, array $params)
    {
        /** @var Argument $argument */
        foreach ($this->getArguments() as $argument) {
            if ($argument->isApplicable($params)) {
                $this->getServiceManager()->propagate($argument);
                $argument->load($action);
            }
        }
    }
785389
public function get($action, $queryParams = [])
    {
        return \GuzzleHttp\json_decode($this->getGuzzle()->get($this->getApiUrl($action, $queryParams))->getBody(), true);
    }
616675
public function buildUri(array $params = null, $controller = null, $action = null, $prepareUri = true)
    {
        $request = Container::getRequest();
        $request->setBaseUrl($this->getBaseUrl());
        if ($prepareUri) {
            [$params, $controller, $action] = $this->prepareUri($params, $controller, $action);
        } else {
            $params = $params ?? [];
            $controller = $controller ?? self::DEFAULT_CONTROLLER;
            $action = $action ?? self::DEFAULT_ACTION;
        }
        if (!is_array($params)) {
            $params = [];
        }
        if (isset($params['controller']) && ($controller === self::DEFAULT_CONTROLLER)) {
            $controller = $params['controller'];
            unset($params['controller']);
        }
        if (isset($params['action']) && ($action === self::DEFAULT_ACTION)) {
            $action = $params['action'];
            unset($params['action']);
        }
        $hasParams = count($params);
        $hasController = $controller != self::DEFAULT_CONTROLLER;
        $hasAction = $action != self::DEFAULT_ACTION;
        $uri  = $hasParams || $hasAction || $hasController ? '/' . $controller : '/';
        $uri .= $hasParams || $hasAction ? '/' . $action : '';
        foreach ($params as $key => $value) {
            $uri .= '/' . $key . '/' . $value;
        }
        
        $uri = '/' . ltrim(rtrim($request->getBaseUrl(), '/') . $uri, '/');
        return $uri;
    }
111923
protected function request($action = '', array $params = [])
    {

        $params['Token'] = $this->config['api']['token'];
        if ($action !== '') {
            $params['Action'] = $action;
        }

        $query = http_build_query($params);
        $url   = $this->config['api']['url'];

        $ch = curl_init();

        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_HEADER, 0);
        curl_setopt($ch, CURLOPT_POST, 1);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $query);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1);
        curl_setopt($ch, CURLOPT_TIMEOUT, 60);

        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);

        $result = curl_exec($ch);
        curl_close($ch);

        if (!$result) {

            throw new Exception('Connection failed. Reason unknown.');
        }

        return $result;
    }
69000
private function callClassController($controller, $action)
    {
        if (!class_exists($controller)) {
            throw new AppException(sprintf('Invalid class name or class "%s" does not exists', $controller));
        }

        $instance = new $controller($this);

        if ($res = $this->callMethod($instance, 'before')) {
            return $res;
        }

        if (false === $response = $this->callMethod($instance, $action)) {
            throw new AppException(sprintf('Unable to call action "%s" on controller "%s"', $action, $controller));
        }

        if ($res = $this->callMethod($instance, 'after')) {
            return $res;
        }

        return $response;
    }
975798
public function toRoute($action, $params=[])
    {
        $params = (array)$params;
        $url = URL::route($this->routePrefix . '.' . $action, $params);

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

        return $url;

    }
328696
public function getPositionByName($controller, $action = null)
    {
        if ($action === null) {
            list($controller, $action) = explode('.', $controller);
        }
        return array_search("{$controller}.{$action}", $this->action_names);
    }
72994
public static function hasAccess(User $user, $controller, $action, $parameters) {
        $access = true;
        foreach (self::getImplementations() as $impl) {
            $access = $access && $impl->hasAccess($user, $controller, $action, $parameters);
        }
        return $access;
    }
1229156
public function getDynamicLoader($controller, $params = null){
        $attributes = [
            'data-config'     => $this->configUrl,
            'src'             => $this->requireJsUrl,
            'data-main'       => $this->bootstrapUrl,
            'data-controller' => $controller
        ];

        if(!is_null($params)){
            $attributes['data-params'] = json_encode($params);
        }

        return $this->buildScriptTag($attributes);
    }
181543
protected function urlRoute($module, $controller, $params): string
    {
        $url = $this->getBaseUrl();

        if (empty($params) && $controller === self::DEFAULT_CONTROLLER) {
            if ($module === self::DEFAULT_MODULE) {
                return $url;
            }
            return $url . $module;
        }

        $url .= $module . '/' . $controller;
        $getParams = [];
        foreach ($params as $key => $value) {
            // sub-array as GET params
            if (\is_array($value)) {
                $getParams[$key] = $value;
                continue;
            }
            $url .= '/' . urlencode((string)$key) . '/' . urlencode((string)$value);
        }
        if (!empty($getParams)) {
            $url .= '?' . http_build_query($getParams);
        }
        return $url;
    }
580414
public function excludeParams($controller, $params){
		$cid = $controller->id;
		$params = is_array($params) ? $params : array($params);

		if(!isset($this->excluded_params[$cid])){
			$this->excluded_params[$cid] = array();
		}

		foreach($params as $p => $v){
			if(is_numeric($p)){
				$p = $v;
				$v = null;
			}

			foreach($this->excluded_params[$cid] as $param => $value){
				if(is_numeric($param)){
					$param = $value;
					$value = null;
				}

				if($p == $param){
					if(is_null($v)){
						$this->excluded_params[$cid][$param] = null;
						continue 2;
					}

					$value = is_array($value) ? $value : array($value);
					$v = is_array($v) ? $value : array($v);

					$value = array_merge($value, $v);

					$this->excluded_params[$cid][$param] = $value;
					continue 2;
				}
			}

			$this->excluded_params[$cid][$p] = $v;
		}

		return $this;
	}