Copied!

PSR-7 request implementation.

CloneableInstantiable
Methods
public __construct(string $method, $uri, array $headers = [], $body = NULL, string $version = '1.1')
 
  • param string $method HTTP method
  • param string|\UriInterface $uri URI
  • param (string|string[])[] $headers Request headers
  • param string|resource|\StreamInterface|null $body Request body
  • param string $version Protocol version
public getBody() : Psr\Http\Message\StreamInterface
public getHeader( $header) : array
public getHeaderLine( $header) : string
public getHeaders() : array
public getMethod() : string
public getProtocolVersion() : string
public getRequestTarget() : string
public getUri() : Psr\Http\Message\UriInterface
public hasHeader( $header) : bool
public withAddedHeader( $header, $value) : Psr\Http\Message\MessageInterface
public withBody(Psr\Http\Message\StreamInterface $body) : Psr\Http\Message\MessageInterface
public withHeader( $header, $value) : Psr\Http\Message\MessageInterface
public withMethod( $method) : Psr\Http\Message\RequestInterface
public withoutHeader( $header) : Psr\Http\Message\MessageInterface
public withProtocolVersion( $version) : Psr\Http\Message\MessageInterface
public withRequestTarget( $requestTarget) : Psr\Http\Message\RequestInterface
public withUri(Psr\Http\Message\UriInterface $uri, $preserveHost = false) : Psr\Http\Message\RequestInterface
Properties
private $headerNames = []
 
  • var string[] Map of lowercase header name => original name at registration
private $headers = []
 
  • var string[][] Map of all registered headers, as original name => array of values
private $method = NULL
 
  • var string
private $protocol = '1.1'
 
  • var string
private $requestTarget = NULL
 
  • var string|null
private $stream = NULL
 
  • var \StreamInterface|null
private $uri = NULL
 
  • var \UriInterface
Methods
private assertHeader( $header) : void
 
  • see https://datatracker.ietf.org/doc/html/rfc7230#section-3.2
  • param mixed $header
private assertMethod( $method) : void
 
  • param mixed $method
private assertValue(string $value) : void
 
  • see https://datatracker.ietf.org/doc/html/rfc7230#section-3.2field-value = ( field-content / obs-fold ) field-content = field-vchar [ 1( SP / HTAB ) field-vchar ] field-vchar = VCHAR / obs-text VCHAR = %x21-7E obs-text = %x80-FF obs-fold = CRLF 1*( SP / HTAB )
private normalizeHeaderValue( $value) : array
 
  • param mixed $value
  • return string[]
private setHeaders(array $headers) : void
 
  • param (string|string[])[] $headers
private trimAndValidateHeaderValues(array $values) : array
 

Trims whitespace from the header values.

Spaces and tabs ought to be excluded by parsers when extracting the field value from a header field.

header-field = field-name ":" OWS field-value OWS OWS = *( SP / HTAB )

  • param array $values Header values
  • return string[] Trimmed header values
  • see https://datatracker.ietf.org/doc/html/rfc7230#section-3.2.4
private updateHostFromUri() : void
© 2024 Bruce Wells
Search Namespaces \ Classes
Configuration