DateHeader
extends AbstractHeader
in package
Reads a DatePart value header in either RFC 2822 or RFC 822 format.
Tags
Table of Contents
- $name : string
- $parts : array<string|int, IHeaderPart>
- $rawValue : string
- __construct() : mixed
- Assigns the header's name and raw value, then calls getConsumer and setParseHeaderValue to extract a parsed value.
- __toString() : string
- Returns the string representation of the header.
- getDateTime() : DateTime|null
- Convenience method returning the part's DateTime object, or null if the date could not be parsed.
- getDateTimeImmutable() : DateTimeImmutable|null
- Returns a DateTimeImmutable for the part's DateTime object, or null if the date could not be parsed.
- getName() : string
- Returns the name of the header.
- getParts() : array<string|int, IHeaderPart>
- Returns an array of IHeaderPart objects the header's value has been parsed into.
- getRawValue() : string
- Returns the raw value of the header.
- getValue() : string
- Returns the parsed 'value' of the header.
- getConsumer() : AbstractConsumer
- Returns a DateConsumer.
- setParseHeaderValue() : static
- Calls the consumer and assigns the parsed parts to member variables.
Properties
$name
protected
string
$name
the name of the header
$parts
protected
array<string|int, IHeaderPart>
$parts
the header's parts (as returned from the consumer)
$rawValue
protected
string
$rawValue
the raw value
Methods
__construct()
Assigns the header's name and raw value, then calls getConsumer and setParseHeaderValue to extract a parsed value.
public
__construct(ConsumerService $consumerService, string $name, string $value) : mixed
Parameters
- $consumerService : ConsumerService
-
For parsing the value.
- $name : string
-
Name of the header.
- $value : string
-
Value of the header.
Return values
mixed —__toString()
Returns the string representation of the header.
public
__toString() : string
i.e.: '<HeaderName>: <RawValue>'
Return values
string —The string representation.
getDateTime()
Convenience method returning the part's DateTime object, or null if the date could not be parsed.
public
getDateTime() : DateTime|null
Return values
DateTime|null —The parsed DateTime object.
getDateTimeImmutable()
Returns a DateTimeImmutable for the part's DateTime object, or null if the date could not be parsed.
public
getDateTimeImmutable() : DateTimeImmutable|null
Return values
DateTimeImmutable|null —The parsed DateTimeImmutable object.
getName()
Returns the name of the header.
public
getName() : string
Return values
string —The name.
getParts()
Returns an array of IHeaderPart objects the header's value has been parsed into.
public
getParts() : array<string|int, IHeaderPart>
Return values
array<string|int, IHeaderPart> —getRawValue()
Returns the raw value of the header.
public
getRawValue() : string
Return values
string —The raw value.
getValue()
Returns the parsed 'value' of the header.
public
getValue() : string
For headers that contain multiple parts, like address headers (To, From) or parameter headers (Content-Type), the 'value' is the value of the first parsed part.
Return values
string —The value
getConsumer()
Returns a DateConsumer.
protected
getConsumer(ConsumerService $consumerService) : AbstractConsumer
Parameters
- $consumerService : ConsumerService
Return values
AbstractConsumer —setParseHeaderValue()
Calls the consumer and assigns the parsed parts to member variables.
protected
setParseHeaderValue(AbstractConsumer $consumer) : static
The default implementation assigns the returned value to $this->part.
Parameters
- $consumer : AbstractConsumer