public static function create(ServerRequestInterface $request)
    {
        $method = strtolower($request->getMethod());
        $query = $request->getQueryParams();
        $post = $request->getParsedBody();

        $input = new PsrInput(array_merge($query, $post));
        $input->setMethod($request->getMethod());

        $filter = $input->getFilter() instanceof NullFilter ? null : $input->getFilter();

        // Sort by importance
        $input->get = new Input($query, $filter);
        $input->post = new Input($method === 'post' ? $post : [], $filter);
        $input->files = new PsrFilesInput($request->getUploadedFiles(), $filter);
        $input->put = new Input($method === 'put' ? $post : [], $filter);
        $input->patch = new Input($method === 'patch' ? $post : [], $filter);
        $input->delete = new Input($method === 'delete' ? $post : [], $filter);
        $input->link = new Input($method === 'link' ? $post : [], $filter);
        $input->unlink = new Input($method === 'unlink' ? $post : [], $filter);
        $input->request = new Input(array_merge($query, $post));

        // Super Globals
        $input->server = new Input($request->getServerParams(), $filter);
        $input->header = new PsrHeaderInput($request->getHeaders(), $filter);
        $input->cookie = new CookieInput($request->getCookieParams(), $filter);

        return $input;
    }
public static function create(ServerRequestInterface $request)
    {
        $method = strtolower($request->getMethod());
        $query = $request->getQueryParams();
        $post = $request->getParsedBody();

        $input = new PsrInput(array_merge($query, $post));
        $input->setMethod($request->getMethod());

        $filter = $input->getFilter() instanceof NullFilter ? null : $input->getFilter();

        // Sort by importance
        $input->get = new Input($query, $filter);
        $input->post = new Input($method === 'post' ? $post : [], $filter);
        $input->files = new PsrFilesInput($request->getUploadedFiles(), $filter);
        $input->put = new Input($method === 'put' ? $post : [], $filter);
        $input->patch = new Input($method === 'patch' ? $post : [], $filter);
        $input->delete = new Input($method === 'delete' ? $post : [], $filter);
        $input->link = new Input($method === 'link' ? $post : [], $filter);
        $input->unlink = new Input($method === 'unlink' ? $post : [], $filter);
        $input->request = new Input(array_merge($query, $post));

        // Super Globals
        $input->server = new Input($request->getServerParams(), $filter);
        $input->header = new PsrHeaderInput($request->getHeaders(), $filter);
        $input->cookie = new CookieInput($request->getCookieParams(), $filter);

        return $input;
    }
public static function create ( ServerRequestInterface $ request ) { $ method = strtolower ( $ request -> getMethod ( ) ) ; $ query = $ request -> getQueryParams ( ) ; $ post = $ request -> getParsedBody ( ) ; $ input = new PsrInput ( array_merge ( $ query , $ post ) ) ; $ input -> setMethod ( $ request -> getMethod ( ) ) ; $ filter = $ input -> getFilter ( ) instanceof NullFilter ? null : $ input -> getFilter ( ) ; // Sort by importance $ input -> get = new Input ( $ query , $ filter ) ; $ input -> post = new Input ( $ method === 'post' ? $ post : [ ] , $ filter ) ; $ input -> files = new PsrFilesInput ( $ request -> getUploadedFiles ( ) , $ filter ) ; $ input -> put = new Input ( $ method === 'put' ? $ post : [ ] , $ filter ) ; $ input -> patch = new Input ( $ method === 'patch' ? $ post : [ ] , $ filter ) ; $ input -> delete = new Input ( $ method === 'delete' ? $ post : [ ] , $ filter ) ; $ input -> link = new Input ( $ method === 'link' ? $ post : [ ] , $ filter ) ; $ input -> unlink = new Input ( $ method === 'unlink' ? $ post : [ ] , $ filter ) ; $ input -> request = new Input ( array_merge ( $ query , $ post ) ) ; // Super Globals $ input -> server = new Input ( $ request -> getServerParams ( ) , $ filter ) ; $ input -> header = new PsrHeaderInput ( $ request -> getHeaders ( ) , $ filter ) ; $ input -> cookie = new CookieInput ( $ request -> getCookieParams ( ) , $ filter ) ; return $ input ; }
Create Input from Psr ServerRequest

@param   ServerRequestInterface $request

@return  static
Create Input from Psr ServerRequest