Get action argument.

@param  array $validActions

@return array
508046
protected function getActionArgument($validActions = [])
    {
        $action = strtolower($this->argument('action'));

        if (in_array($action, $validActions) === false) {
            throw new \RuntimeException("The \"{$action}\" option does not exist.");
        }

        return $action;
    }
774635
public function setAction($action)
    {
        $allowedValues = $this->getActionAllowableValues();
        if (!in_array($action, $allowedValues)) {
            throw new \InvalidArgumentException(
                sprintf(
                    "Invalid value for 'action', must be one of '%s'",
                    implode("', '", $allowedValues)
                )
            );
        }
        $this->container['action'] = $action;

        return $this;
    }
533259
public function parseArguments(array $args)
    {
        $this->action = null;
        $this->arguments = array();
        $parsed = array();
        $argument = reset($args);
        while ($argument) {
            if (strpos($argument, '=') > 0) {
                $arg = explode('=', $argument);
                $argKey = ltrim($arg[0], '-');
                $argValue = trim($arg[1], '"');
                $parsed[$argKey] = $argValue;
            } else {
                $parsed[ltrim($argument, '-')] = true;
            }
            $argument = next($args);
        }
        if (!isset($parsed['action']) || empty($parsed['action'])) {
            if (isset($parsed['version']) ||  isset($parsed['V'])) {
                $this->action = 'Version';
                $this->arguments = $parsed;
                return $this->arguments;
            }
            if (isset($parsed['help']) || isset($parsed['h'])) {
                $this->action = 'Help';
                $this->arguments = $parsed;
                return $this->arguments;
            }
            throw new RequestException($this, "No valid action argument specified.");
        }
        $this->action = $parsed['action'];
        unset($parsed['action']);
        $this->arguments = $parsed;
        return $this->arguments;
    }
647295
protected function parseAsSidebarActions(array $actions)
    {
        $sidebarActions = [];
        foreach ($actions as $ident => $action) {
            $ident  = $this->parseActionIdent($ident, $action);
            $action = $this->parseActionItem($action, $ident, true);

            if (!isset($action['priority'])) {
                $action['priority'] = $this->actionsPriority++;
            }

            if ($action['ident'] === 'view' && !$this->isObjViewable()) {
                $action['active'] = false;
            } elseif ($action['ident'] === 'save' && !$this->isObjSavable()) {
                $action['active'] = false;
            } elseif ($action['ident'] === 'reset' && !$this->isObjResettable()) {
                $action['active'] = false;
            } elseif ($action['ident'] === 'delete' && !$this->isObjDeletable()) {
                $action['active'] = false;
            }

            if ($action['isSubmittable'] && !$this->isObjSavable()) {
                $action['active'] = false;
            }

            if ($action['actions']) {
                $action['actions']    = $this->parseAsSidebarActions($action['actions']);
                $action['hasActions'] = !!array_filter($action['actions'], function ($action) {
                    return $action['active'];
                });
            }

            if (isset($sidebarActions[$ident])) {
                $hasPriority = ($action['priority'] > $sidebarActions[$ident]['priority']);
                if ($hasPriority || $action['isSubmittable']) {
                    $sidebarActions[$ident] = array_replace($sidebarActions[$ident], $action);
                } else {
                    $sidebarActions[$ident] = array_replace($action, $sidebarActions[$ident]);
                }
            } else {
                $sidebarActions[$ident] = $action;
            }
        }

        usort($sidebarActions, [ $this, 'sortActionsByPriority' ]);

        while (($first = reset($sidebarActions)) && $first['isSeparator']) {
            array_shift($sidebarActions);
        }

        while (($last = end($sidebarActions)) && $last['isSeparator']) {
            array_pop($sidebarActions);
        }

        return $sidebarActions;
    }
991495
public function getRules($action = null){

        $rules = $this->rules;

        if( isset($this->rules[$action]) ){
            $rules = $this->rules[$action];
        }

        return $this->parserValidationRules($rules, $this->id);
    }
346721
protected function parseAsObjectActions(array $actions)
    {
        $objectActions = [];
        foreach ($actions as $action) {
            $action = $this->parseActionRenderables($action, true);

            if (isset($action['ident'])) {
                if ($action['ident'] === 'view' && !$this->isObjViewable()) {
                    $action['active'] = false;
                } elseif ($action['ident'] === 'create' && !$this->isObjCreatable()) {
                    $action['active'] = false;
                } elseif ($action['ident'] === 'edit' && !$this->isObjEditable()) {
                    $action['active'] = false;
                } elseif ($action['ident'] === 'delete' && !$this->isObjDeletable()) {
                    $action['active'] = false;
                }
            }

            if ($action['actions']) {
                $action['actions']    = $this->parseAsObjectActions($action['actions']);
                $action['hasActions'] = !!array_filter($action['actions'], function ($action) {
                    return $action['active'];
                });
            }

            $objectActions[] = $action;
        }

        return $objectActions;
    }
999360
private function constructAction($action, array $arguments = []): bool
    {
        if (is_callable($action)) {
            $this->pendingAction = $action;

            return true;
        } elseif (is_string($action)) {
            $actionParts = explode('@', $action);

            $controllerName = 'App\\Http\\Controllers\\' . $actionParts[0];
            $methodName = $actionParts[1];

            if (!class_exists($controllerName)) {
                throw new HTTPException('Not found', 404);
            }

            $controller = $this->container->get($controllerName);

            if (!method_exists($controller, $methodName)) {
                throw new HTTPException('Not found', 404);
            }

            $this->pendingAction = [
                'controller' => $controllerName,
                'method' => $methodName,
                'arguments' => $arguments,
            ];

            return true;
        }

        return false;
    }
988678
public function getAction()
    {
        if (!is_null(self::$action)) {
            return self::$action;
        }
        $controllerParam = array_get($this->routeParams, 'controller');
        $match           = null;

        if (!preg_match("/.+?(?=@)@(.*)/", $controllerParam, $match)) {
            return;
        }
        self::$action = strtolower($match[1]);
        return self::$action;
    }
708920
public function action($action, $parameters = array(), $absolute = true)
    {
        return $this->forwarder()->action($action, $parameters, $absolute);
    }
1168862
public function info($params = [])
    {
        $params = array_merge($this->auth->getCredentials(), $params);

        return $this->client->get(self::ACTION_NAME, $params);
    }
491559
protected function action($action)
    {
        $action = in_array($action, $this->actions) ? $action : null;
        $action = array_key_exists($action, $this->aliases) ? $this->aliases[$action] : $action;

        return $action;
    }
537491
public function getActions()
    {
        if (null === $this->actions) {
            $this->actions = array();
            $this->findActions();
        }

        return $this->actions;
    }
885792
public function getActionIDs()
    {
        $actions = array_unique(preg_split('/[\s,]+/', $this->actions, -1, PREG_SPLIT_NO_EMPTY));
        sort($actions);

        return $actions;
    }
826287
protected function getInformationNeededForInitializeActionMethodValidators()
    {
        return [
            static::getActionValidationGroups($this->objectManager),
            static::getActionMethodParameters($this->objectManager),
            static::getActionValidateAnnotationData($this->objectManager),
            static::getActionIgnoredValidationArguments($this->objectManager)
        ];
    }
280679
protected function _actionCheck()
    {
        $actions = $this->getConfig('actions');
        if (is_bool($actions)) {
            return $actions;
        }

        return in_array($this->request->getParam('action'), (array)$actions, true);
    }
549375
public function addAction($action, $actionParams)
    {
        // check if valid rule usage for object_type_id
        $this->validateRule("Actions", $action);
        // get required parameters for specific rule
        $requiredParams = Actions::GetRequiredParams($action);
        // checking for missing and invalid parameters
        $exception = false;
        if ($action == Actions::PING_URL)
        {
            $exception = true;
        }
        $check_params = $this->_checkParams($requiredParams, $actionParams, $exception);
        // if no missing or invalid rule parameters
        if ($check_params)
        {
            $rule = $action;
            // special formatting for ping_url
            if ($action == Actions::PING_URL)
            {
                $formatted = $this->_formatParams($actionParams, "::");
                $this->_actions[] = $action . "(" . $formatted . ")";

                return $this->_actions;
            }
            // general formatting for actions
            $value = $this->_formatParams($actionParams);
            $formatted = "(" . $value . ")";
            $this->_actions[] = $rule . $formatted;

            return $this->_actions;
        }
        return false;
    }
281792
protected function parseConditionParams(array $action): array
    {
        if (empty($this->condition)) {
            return [];
        }

        $params = Arr::first($action, function ($value, $key) {
            return is_numeric($key);
        });

        return [$params];
    }