src/SlimController/SlimController.php
protected function params($names = array(), $reqMode = null, $defaults = null)
    {
        // no names given -> get them all
        if (!$names) {
            $names = $this->getAllParamNames($reqMode);
        }
        $res = array();
        foreach ($names as $obj) {
            $name  = is_array($obj) ? $obj[0] : $obj;
            $param = $this->param($name, $reqMode);
            if (!is_null($param) && (!is_array($param) || !empty($param))) {
                $res[$name] = $param;
            } // if in "need all" mode
            elseif ($defaults === true) {
                return null;
            } // if in default mode
            elseif (is_array($defaults) && isset($defaults[$name])) {
                $res[$name] = $defaults[$name];
            }
        }

        return $res;
    }
protected function params($names = array(), $reqMode = null, $defaults = null)
    {
        // no names given -> get them all
        if (!$names) {
            $names = $this->getAllParamNames($reqMode);
        }
        $res = array();
        foreach ($names as $obj) {
            $name  = is_array($obj) ? $obj[0] : $obj;
            $param = $this->param($name, $reqMode);
            if (!is_null($param) && (!is_array($param) || !empty($param))) {
                $res[$name] = $param;
            } // if in "need all" mode
            elseif ($defaults === true) {
                return null;
            } // if in default mode
            elseif (is_array($defaults) && isset($defaults[$name])) {
                $res[$name] = $defaults[$name];
            }
        }

        return $res;
    }
protected function params ( $ names = array ( ) , $ reqMode = null , $ defaults = null ) { // no names given -> get them all if ( ! $ names ) { $ names = $ this -> getAllParamNames ( $ reqMode ) ; } $ res = array ( ) ; foreach ( $ names as $ obj ) { $ name = is_array ( $ obj ) ? $ obj [ 0 ] : $ obj ; $ param = $ this -> param ( $ name , $ reqMode ) ; if ( ! is_null ( $ param ) && ( ! is_array ( $ param ) || ! empty ( $ param ) ) ) { $ res [ $ name ] = $ param ; } // if in "need all" mode elseif ( $ defaults === true ) { return null ; } // if in default mode elseif ( is_array ( $ defaults ) && isset ( $ defaults [ $ name ] ) ) { $ res [ $ name ] = $ defaults [ $ name ] ; } } return $ res ; }
Reads multiple params at once

<code>
$params = $this->params(['prefix.name', 'other.name']); //  -> ["prefix.name" => "value", ..]
$params = $this->params(['prefix.name', 'other.name'], true); //  -> null if not all found
$params = $this->params(['prefix.name', 'other.name'], ['other.name' => "Default Value"]);
</code>

@param mixed $names    Name or names of parameters (GET or POST)
@param mixed $reqMode  Optional mode. Either null (all params), true | "post"
(only POST params), false | "get" (only GET params)
@param mixed $defaults Either true (require ALL given or return null), array (defaults)

@return mixed Either array or single string or null
Reads multiple params at once