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
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 = ',' )
|
public
string
|
#
__toString( )
Hooks into native PHP string language constructs, and returns the string representation of the header value. |
public
string
|
|
public
array
|
|
public
string
|
|
public
|
|
public
|
#
appendValue( string $value )
Adds an additional value to append to the header value. This method will not replace existing values. |
public
|
|
protected
|
#
_initializeHeader( string $name, string|array $value, string $type = 'response', string $separator = ',' )
|
private
|
|
private
|
|
private
|
|
private
|
|
private
|
|
private
|
|
private
|
#
_setHeaderSeparator( string $separator = ',' )
Sets the separator used for the header if it can contain multiple values. |
private
|
|
private
|
#
_appendAdditionalHeaderValue( string $value )
Adds an additional header value to the internal index of values. |
private
|
#
_checkHeaderCustom( )
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. |
Properties summary
private static
array
|
$_headers_valid
Represents common headers as defined by http specification and common non-standard headers with wide useage. |
#
array()
|
private
string
|
$_header_type
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. |
#
false
|
private
string
|
$_header_name
Represents the correct header name. |
|
private
array
|
$_header_value
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. |
#
','
|
private
boolean
|
$_header_initialized
Represents whether the header has been properly initialized. |
#
false
|