Oroboros Core
  • Namespace
  • Class
  • Tree
  • Deprecated
  • Todo

Namespaces

  • None
  • oroboros
    • core
      • abstracts
        • adapters
        • bootstrap
        • controllers
        • libraries
          • auth
          • bootstrap
          • cache
          • codex
          • config
          • container
          • data
          • database
          • dns
          • entity
          • enum
          • error
          • event
          • extension
          • file
          • flags
          • hooks
          • job
          • logger
          • manager
          • message
          • prototype
          • request
          • response
          • routine
          • shell
          • startup
          • stream
          • template
          • uri
          • utility
          • validation
            • workers
          • worker
        • models
        • patterns
          • behavioral
          • creational
        • utilities
          • exception
            • cache
            • container
          • http
        • views
      • interfaces
        • adapters
          • interpreters
          • sdk
        • api
          • adapters
          • bootstrap
          • controllers
          • psr
        • contract
          • adapters
          • bootstrap
          • codex
          • components
          • controllers
          • data
          • entities
          • errors
          • events
          • extensions
          • jobs
          • libraries
            • auth
            • cache
            • config
            • container
            • enum
            • file
            • flags
            • hooks
            • module
            • promise
            • record
            • request
            • response
            • server
            • shutdown
            • site
            • stream
            • template
            • theme
            • uri
          • models
          • patterns
            • behavioral
            • concurrency
            • creational
            • structural
          • routes
          • routines
            • bootload
            • declarative
            • procedural
            • subsystem
          • services
            • consumer
              • cgi
              • rest
                • local
                • remote
                  • authenticated
                  • unauthenticated
            • provider
              • cgi
              • rest
                • local
                • remote
                  • authenticated
                  • unauthenticated
          • utilities
            • datetime
            • exception
              • cache
              • container
            • filebase
            • http
            • math
            • parser
            • regex
            • session
          • views
        • enumerated
          • environment
          • flags
          • http
          • views
        • libraries
          • manager
          • worker
      • libraries
        • api
        • codex
        • container
        • enum
          • http
        • file
        • hooks
        • logger
        • math
        • psr4
        • request
        • response
        • stream
        • uri
      • patterns
        • creational
      • traits
        • adapters
        • bootstrap
        • codex
        • components
        • controllers
        • data
        • entities
        • events
        • extensions
        • jobs
        • libraries
          • container
          • file
          • request
          • response
          • stream
          • uri
        • models
        • modules
        • patterns
          • behavioral
          • concurrency
          • creational
          • structural
        • routes
        • services
        • utilities
          • core
            • api
            • config
            • contract
              • contract
            • enum
            • environment
            • routines
          • datetime
          • error
          • exception
          • filebase
          • hooks
          • html
          • http
          • logic
          • math
          • parsers
          • regex
          • session
        • views
      • utilities
        • exception
          • cache
          • container
        • http
      • views
    • tests
      • patterns
        • creational
      • psr
        • psr7
      • utilities
        • exception
  • PasswordCompat
    • binary
  • PHP

Interfaces

  • ResponseContract
  • ServerResponseContract

Interface ResponseContract


Contract interfaces enforce expected behavior in a non-colliding way. They are tasked with enforcing methods, and extending interfaces provided by standards and other packages for compatibility.

All valid oroboros classes MUST extend at

least one Contract Interface to be considered valid.

oroboros\core\interfaces\contract\libraries\response\ResponseContract implements oroboros\core\interfaces\contract\libraries\stream\MessageContract, Psr\Http\Message\ResponseInterface

Direct known implementers

oroboros\core\abstracts\libraries\response\AbstractResponse, oroboros\core\interfaces\contract\libraries\response\ServerResponseContract

Indirect known implementers

oroboros\core\libraries\response\Response

Namespace: oroboros\core\interfaces\contract\libraries\response
Package: oroboros\core\response
Category: contract-interfaces
License: The MIT License (MIT)
Author: Brian Dayhoff mopsyd@me.com
Version: 0.2.4
Since: 0.2.4-alpha
Link: bitbucket.org/oroborosframework/oroboros-core/wiki/development/api/contract_interface.md
Located at core/interfaces/contract/libraries/response/ResponseContract.php

Methods summary

public
# __construct( scalar|resource|Psr\Http\Message\StreamInterface $body, array $headers = null, string $protocol = null, integer $code = null, string $reason = null )

Constructs a new instance of a Psr-7 message wrapper.

Constructs a new instance of a Psr-7 message wrapper.

Parameters

$body
This is the only required value for the constructor, and represents a message body as a scalar value, resource pointer, or instance of a stream interface.
$headers
(optional) If provided, represents an array of headers to construct with the message.
$protocol
(optional) If provided, the HTTP request protocol will be set to this value. Default value is "1.1"
$code
(optional) If provided, the HTTP status code. If not provided, defaults to 200.
$reason
(optional) If provided, the HTTP status code reason. If not provided, uses the default for the code

Throws

oroboros\core\utilities\exception\InvalidArgumentException
if any passed parameters do not validate

Implementation of

oroboros\core\interfaces\contract\libraries\stream\MessageContract::__construct()
public integer
# getStatusCode( )

Gets the response status code.

Gets the response status code.

The status code is a 3-digit integer result code of the server's attempt to understand and satisfy the request.

Returns

integer
Status code.
public static
# withStatus( integer $code, string $reasonPhrase = '' )

Return an instance with the specified status code and, optionally, reason phrase.

Return an instance with the specified status code and, optionally, reason phrase.

If no reason phrase is specified, implementations MAY choose to default to the RFC 7231 or IANA recommended reason phrase for the response's status code.

This method MUST be implemented in such a way as to retain the immutability of the message, and MUST return an instance that has the updated status and reason phrase.

Parameters

$code
The 3-digit integer result code to set.
$reasonPhrase

The reason phrase to use with the provided status code; if none is provided, implementations MAY use the defaults as suggested in the HTTP specification.

Returns

static

Throws

InvalidArgumentException
For invalid status code arguments.

See

http://tools.ietf.org/html/rfc7231#section-6
http://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml
public string
# getReasonPhrase( )

Gets the response reason phrase associated with the status code.

Gets the response reason phrase associated with the status code.

Because a reason phrase is not a required element in a response status line, the reason phrase value MAY be empty. Implementations MAY choose to return the default RFC 7231 recommended reason phrase (or those listed in the IANA HTTP Status Code Registry) for the response's status code.

Returns

string
Reason phrase; must return an empty string if none present.

See

http://tools.ietf.org/html/rfc7231#section-6
http://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml

Methods inherited from oroboros\core\interfaces\contract\libraries\stream\MessageContract

getBody(), getHeader(), getHeaderLine(), getHeaders(), getProtocolVersion(), hasHeader(), withAddedHeader(), withBody(), withHeader(), withProtocolVersion(), withoutHeader()

Methods inherited from oroboros\core\interfaces\contract\libraries\stream\StreamContract

__destruct(), __toString(), close(), detach(), eof(), getContents(), getMetadata(), getSize(), isReadable(), isSeekable(), isWritable(), read(), rewind(), seek(), tell(), write()

Oroboros Core API documentation generated by ApiGen