framework/console/Controller.php
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] = $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;
    }
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] = $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;
    }
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 ] = $ 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 ; }
Binds the parameters to the action.
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.
@param Action $action the action to be bound with parameters
@param array $params the parameters to be bound to the action
@return array the valid parameters that the action can run with.
@throws Exception if there are unknown options or missing arguments
Binds the parameters to the action . 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 .