lithium\console\Dispatcher::applyRules PHP Method

applyRules() public static method

Each formatting rule is applied if the key of the rule in $_rules is present and not empty in $params. Also performs sanity checking against $params to ensure that no value matching a rule is present unless the rule check passes.
public static applyRules ( array $params ) : array
$params array An array of route parameters to which rules will be applied.
return array Returns the `$params` array with formatting rules applied to array values.
    public static function applyRules($params)
    {
        $result = array();
        if (!$params) {
            return false;
        }
        foreach (static::$_rules as $name => $rules) {
            foreach ($rules as $rule) {
                if (!empty($params[$name]) && isset($rule[0])) {
                    $options = array_merge(array($params[$name]), isset($rule[2]) ? (array) $rule[2] : array());
                    $result[$name] = call_user_func_array(array($rule[0], $rule[1]), $options);
                }
            }
        }
        return $result + array_diff_key($params, $result);
    }