PSR-7 response implementation.

CloneableInstantiable
ImplementsPsr\Http\Message\MessageInterface
Psr\Http\Message\ResponseInterface
Methods
public __construct( $status = 200, array $headers = [], $body = NULL, $version = '1.1', $reason = NULL)
 


    public getBody()
    public getHeader( $header)
    public getHeaderLine( $header)
    public getHeaders()
    public getProtocolVersion()
    public getReasonPhrase()
    public getStatusCode()
    public hasHeader( $header)
    public withAddedHeader( $header, $value)
    public withBody(Psr\Http\Message\StreamInterface $body)
    public withHeader( $header, $value)
    public withoutHeader( $header)
    public withProtocolVersion( $version)
    public withStatus( $code, $reasonPhrase = '')
    Properties
    private $headerNames
     


    • var array Map of lowercase header name => original name at registration
    private $headers
     


    • var array Map of all registered headers, as original name => array of values
    private static $phrases
     


    • var array Map of standard HTTP status code/reason phrases
    private $protocol
     


    • var string
    private $reasonPhrase
     


    • var string
    private $statusCode
     


    • var int
    private $stream
     


    • var StreamInterface
    Methods
    private assertHeader( $header)
    private assertStatusCodeIsInteger( $statusCode)
    private assertStatusCodeRange( $statusCode)
    private normalizeHeaderValue( $value)
    private setHeaders(array $headers)
    private trimHeaderValues(array $values)
     
    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 )

    • return string[] Trimmed header values
    • see https://tools.ietf.org/html/rfc7230#section-3.2.4
    Properties
    private static $phrases
     


    • var array Map of standard HTTP status code/reason phrases
    © 2020 Bruce Wells
    Search Namespaces \ Classes
    ConfigurationNumbers (0-9.) only