public function withMethod($method)
    {
        $new = clone $this;

        if (!is_string($method) ||
            !preg_match('/^[!#$%&\'*+.^_`\|~0-9a-z-]+$/i', $method)
        ) {
            throw new InvalidArgumentException(sprintf(
                'Unsupported HTTP method "%s" provided',
                $method
            ));
        }
        $new->_environment['REQUEST_METHOD'] = $method;

        return $new;
    }
public function withMethod($method)
    {
        $new = clone $this;

        if (!is_string($method) ||
            !preg_match('/^[!#$%&\'*+.^_`\|~0-9a-z-]+$/i', $method)
        ) {
            throw new InvalidArgumentException(sprintf(
                'Unsupported HTTP method "%s" provided',
                $method
            ));
        }
        $new->_environment['REQUEST_METHOD'] = $method;

        return $new;
    }
public function withMethod ( $ method ) { $ new = clone $ this ; if ( ! is_string ( $ method ) || ! preg_match ( '/^[!#$%&\'*+.^_`\|~0-9a-z-]+$/i' , $ method ) ) { throw new InvalidArgumentException ( sprintf ( 'Unsupported HTTP method "%s" provided' , $ method ) ) ; } $ new -> _environment [ 'REQUEST_METHOD' ] = $ method ; return $ new ; }
Update the request method and get a new instance.

@param string $method The HTTP method to use.
@return static A new instance with the updated method.
@link http://www.php-fig.org/psr/psr-7/ This method is part of the PSR-7 server request interface.
Update the request method and get a new instance .