public static function create($params = null, Request $request = null)
    {
        if ($params === null) {
            return new Params();
        } elseif (is_array($params)) {
            return new Params($params);
        } elseif ($params instanceof \Traversable) {
            return new Params(self::extractParamsFromCollection($params));
        } elseif ($params instanceof \Zend\Mvc\Controller\Plugin\Params) {
            $results = array();
            /* @var $r \Zend\Http\Request */
            foreach (array(
                         $params->fromQuery(),
                         $params->fromPost(),
                         self::getBodyData($request),
                         $params->fromRoute(),
                         $params->fromFiles(),
                     ) as $collection) {
                $results = array_merge($results, $collection);
            }

            return new Params($results);
        } elseif ($params instanceof Param) {
            return new Params($params->get());
        }
        throw new \InvalidArgumentException("Unrecognized parameter collection");
    }
public static function create($params = null, Request $request = null)
    {
        if ($params === null) {
            return new Params();
        } elseif (is_array($params)) {
            return new Params($params);
        } elseif ($params instanceof \Traversable) {
            return new Params(self::extractParamsFromCollection($params));
        } elseif ($params instanceof \Zend\Mvc\Controller\Plugin\Params) {
            $results = array();
            /* @var $r \Zend\Http\Request */
            foreach (array(
                         $params->fromQuery(),
                         $params->fromPost(),
                         self::getBodyData($request),
                         $params->fromRoute(),
                         $params->fromFiles(),
                     ) as $collection) {
                $results = array_merge($results, $collection);
            }

            return new Params($results);
        } elseif ($params instanceof Param) {
            return new Params($params->get());
        }
        throw new \InvalidArgumentException("Unrecognized parameter collection");
    }
public static function create ( $ params = null , Request $ request = null ) { if ( $ params === null ) { return new Params ( ) ; } elseif ( is_array ( $ params ) ) { return new Params ( $ params ) ; } elseif ( $ params instanceof \ Traversable ) { return new Params ( self :: extractParamsFromCollection ( $ params ) ) ; } elseif ( $ params instanceof \ Zend \ Mvc \ Controller \ Plugin \ Params ) { $ results = array ( ) ; /* @var $r \Zend\Http\Request */ foreach ( array ( $ params -> fromQuery ( ) , $ params -> fromPost ( ) , self :: getBodyData ( $ request ) , $ params -> fromRoute ( ) , $ params -> fromFiles ( ) , ) as $ collection ) { $ results = array_merge ( $ results , $ collection ) ; } return new Params ( $ results ) ; } elseif ( $ params instanceof Param ) { return new Params ( $ params -> get ( ) ) ; } throw new \ InvalidArgumentException ( "Unrecognized parameter collection" ) ; }
Create a Param instance
@param  null                      $params
@param  null|Request              $request
@return Params
@throws \InvalidArgumentException
Create a Param instance