Copied!

Trait implementing functionality common to requests and responses.

Trait
Methods
public getBody() : Psr\Http\Message\StreamInterface
public getHeader( $header) : array
public getHeaderLine( $header) : string
public getHeaders() : array
public getProtocolVersion() : string
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 withoutHeader( $header) : Psr\Http\Message\MessageInterface
public withProtocolVersion( $version) : Psr\Http\Message\MessageInterface
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 $protocol = '1.1'
 
  • var string
private $stream = NULL
 
  • var \StreamInterface|null
Methods
private assertHeader( $header) : void
 
  • see https://datatracker.ietf.org/doc/html/rfc7230#section-3.2
  • param mixed $header
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
© 2024 Bruce Wells
Search Namespaces \ Classes
Configuration