yii\console\Controller::bindActionParams PHP Method

bindActionParams() public method

This method is invoked by [[Action]] when it begins to run with the given parameters. This method will first bind the parameters with the [[options()|options]] available to the action. It then validates the given arguments.
public bindActionParams ( Action $action, array $params ) : array
$action yii\base\Action the action to be bound with parameters
$params array the parameters to be bound to the action
return array the valid parameters that the action can run with.
    public function bindActionParams($action, $params)
    {
        if ($action instanceof InlineAction) {
            $method = new \ReflectionMethod($this, $action->actionMethod);
        } else {
            $method = new \ReflectionMethod($action, 'run');
        }
        $args = array_values($params);
        $missing = [];
        foreach ($method->getParameters() as $i => $param) {
            if ($param->isArray() && isset($args[$i])) {
                $args[$i] = preg_split('/\\s*,\\s*/', $args[$i]);
            }
            if (!isset($args[$i])) {
                if ($param->isDefaultValueAvailable()) {
                    $args[$i] = $param->getDefaultValue();
                } else {
                    $missing[] = $param->getName();
                }
            }
        }
        if (!empty($missing)) {
            throw new Exception(Yii::t('yii', 'Missing required arguments: {params}', ['params' => implode(', ', $missing)]));
        }
        return $args;
    }