Class Header
Base class for header fields.
Classes that extend the class and support attributes must defined them during construct:
<?php class ContentDisposition extends Header { public function __construct($value=null, array $attributes=array()) { $this->parameters['filename'] = new HeaderParameter('filename'); parent::__construct($value, $attributes); } }
Magic properties are automatically mapped to parameters. The value of a parameter is accessed through its corresponding property:
<?php $cd = new ContentDisposition; $cd->filename = "Statistics.csv"; echo $cd->filename; // "Statistics.csv"
The instance of the parameter itself is accessed using the header as an array:
<?php $cd = new ContentDisposition; $cd['filename']->value = "Statistics.csv"; $cd['filename']->language = "en";
An alias to the ICanBoogie\HTTP\Header::$value
property can be defined by using the
VALUE_ALIAS
constant. The following code defines type
as an alias:
<?php class ContentDisposition extends Header { const VALUE_ALIAS = 'type'; }
- ICanBoogie\HTTP\Header implements ArrayAccess
Direct known subclasses
ICanBoogie\HTTP\ContentDispositionHeader
,
ICanBoogie\HTTP\ContentTypeHeader
Methods summary
public static
|
#
from( string|
Creates a |
protected static
array
|
#
parse( string|
Parse the provided source and extract its value and parameters. |
public
|
|
public
|
|
public
|
|
public
|
|
public
|
#
__construct( string $value = null, array $parameters = array() )
Initializes the $name, |
public
mixed
|
|
public
|
|
public
|
|
public
string
|
Magic methods summary
Constants summary
mixed |
VALUE_ALIAS
|
null |
Properties summary
public
string
|
$value |
#
The value of the header. |
protected
array[string]HeaderParameter
|
$parameters |
#
The parameters supported by the header. |