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

Traits

  • CookieTrait
  • HeaderTrait
  • ProtocolTrait
  • RequestHeaderTrait
  • RequestMethodTrait
  • ResponseHeaderTrait
  • StatusCodeTrait

Trait HeaderTrait

Provides a simple means for representing a header as an object.

Traits provide extended method support to classes without requiring a direct, linear chain of inheritance. This allows functions to inherit subsets of related methods without declaring a parent class.

In Oroboros core, ALL methods are granted to classes via traits, and the classes themselves are just containers that correlate their methods to an interface they are expected to honor. This approach maximizes interoperability, by entirely removing class inheritance as a requirement for extension of any class in this system.

3rd parties using this package are not expected to follow this approach,

but ALL of our internal class and logic structure does.

Direct Known Users

oroboros\core\abstracts\utilities\http\AbstractHeader, oroboros\core\traits\utilities\http\RequestHeaderTrait, oroboros\core\traits\utilities\http\ResponseHeaderTrait

Indirect Known Users

oroboros\core\utilities\http\Header

Namespace: oroboros\core\traits\utilities\http
Package: oroboros\core\utilities
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/traits/utilities/http/HeaderTrait.php

Methods summary

public
# __construct( string $name, string|array $value, string $type = 'response', string $separator = ',' )

Constructs an object representation of a header

Constructs an object representation of a header

Parameters

$name
the case insensitive header name
$value
$values Represents the value of the header. May be a string or an array. If the header can have multiple values and a string is passed, the string will be split based on the defined separator.
$type
$separator (optional) designates the correct separator for headers that carry multiple values. Defaults to a comma if not supplied.
$separator
$type (optional) designates whether the specified header is a request or response header. Assumes response if not defined otherwise.

Throws

oroboros\core\utilities\exception\InvalidArgumentException
if an invalid parameter was passed

Link

https://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.2
public string
# __toString( )

Hooks into native PHP string language constructs, and returns the string representation of the header value.

Hooks into native PHP string language constructs, and returns the string representation of the header value.

Returns

string
public string
# getName( )

Returns the name of the header.

Returns the name of the header.

Returns

string
public array
# getValue( )

Returns the value(s) of the header, represented as an array.

Returns the value(s) of the header, represented as an array.

Returns

array
public string
# getValueString( )

Returns only the header value, contencated as a string.

Returns only the header value, contencated as a string.

Returns

string
public
# setValue( string|array $value )

Replaces the existing value with the supplied value.

Replaces the existing value with the supplied value.

Parameters

$value

Throws

oroboros\core\utilities\exception\InvalidArgumentException
if an invalid parameter was passed
public
# appendValue( string $value )

Adds an additional value to append to the header value. This method will not replace existing values.

Adds an additional value to append to the header value. This method will not replace existing values.

Parameters

$value

Throws

oroboros\core\utilities\exception\InvalidArgumentException
if an invalid parameter was passed
public
# send( )

Sends the header. This will replace the same header if it has already been sent.

Sends the header. This will replace the same header if it has already been sent.

protected
# _initializeHeader( string $name, string|array $value, string $type = 'response', string $separator = ',' )

Creates the internal values representing the header.

Creates the internal values representing the header.

Parameters

$name
the case insensitive header name
$value
$values Represents the value of the header. May be a string or an array. If the header can have multiple values and a string is passed, the string will be split based on the defined separator.
$type
$separator (optional) designates the correct separator for headers that carry multiple values. Defaults to a comma if not supplied.
$separator
$type (optional) designates whether the specified header is a request or response header. Assumes response if not defined otherwise.

Throws

oroboros\core\utilities\exception\InvalidArgumentException
if an invalid parameter was passed
private
# _validateHeaderName( string $name )

Checks if the supplied name is a valid type.

Checks if the supplied name is a valid type.

Parameters

$name

Throws

oroboros\core\utilities\exception\InvalidArgumentException
if an invalid parameter was passed
private
# _validateHeaderValue( string|array $value )

Checks if the supplied value is a valid type.

Checks if the supplied value is a valid type.

Parameters

$value

Throws

oroboros\core\utilities\exception\InvalidArgumentException
if an invalid parameter was passed
private
# _validateHeaderType( string $type )

Checks if the supplied type is a valid.

Checks if the supplied type is a valid.

Parameters

$type

Throws

oroboros\core\utilities\exception\InvalidArgumentException
if an invalid parameter was passed
private
# _validateHeaderSeparator( string $separator )

Checks if the supplied separator is a valid.

Checks if the supplied separator is a valid.

Parameters

$separator

Throws

oroboros\core\utilities\exception\InvalidArgumentException
if an invalid parameter was passed
private
# _setHeaderName( string $name )

Sets the internal name for the header.

Sets the internal name for the header.

Parameters

$name
private
# _setHeaderType( string $type )

Sets the internal type for the header.

Sets the internal type for the header.

Parameters

$type
$name
private
# _setHeaderSeparator( string $separator = ',' )

Sets the separator used for the header if it can contain multiple values.

Sets the separator used for the header if it can contain multiple values.

Parameters

$separator
private
# _setHeaderValue( string|array $value )

Sets the internal value(s) for the header.

Sets the internal value(s) for the header.

Parameters

$value
private
# _appendAdditionalHeaderValue( string $value )

Adds an additional header value to the internal index of values.

Adds an additional header value to the internal index of values.

Parameters

$value
private
# _checkHeaderCustom( )

Checks if the header is known or not, and sets the appropriate boolean flag.

Checks if the header is known or not, and sets the appropriate boolean flag.

private
# _getValidHeaders( )

Obtains a list of known headers. This is set statically, and will only be performed the first time the object instantiates.

Obtains a list of known headers. This is set statically, and will only be performed the first time the object instantiates.

These values are fixed enumerations read from interfaces, and do not change.

Properties summary

private static array $_headers_valid

Represents common headers as defined by http specification and common non-standard headers with wide useage.

Represents common headers as defined by http specification and common non-standard headers with wide useage.

Headers not existing in this array will be marked as custom, but will not be excluded from creation.

# array()
private string $_header_type

Represents whether the header is a request or response header.

Represents whether the header is a request or response header.

# 'response'
private boolean $_header_is_custom

Represents whether the header is a known existing header. If the system could not determine it's identity, this will be true.

Represents whether the header is a known existing header. If the system could not determine it's identity, this will be true.

# false
private string $_header_name

Represents the correct header name.

Represents the correct header name.

#
private array $_header_value

Represents the values supplied for the header.

Represents the values supplied for the header.

# array()
private string $_header_value_separator

Represents the correct separator for the header, if it can contain multiple values.

Represents the correct separator for the header, if it can contain multiple values.

# ','
private boolean $_header_initialized

Represents whether the header has been properly initialized.

Represents whether the header has been properly initialized.

# false
Oroboros Core API documentation generated by ApiGen