Token
extends HeaderPart
in package
Holds a string value token that will require additional processing by a consumer prior to returning to a client.
A Token is meant to hold a value for further processing -- for instance when consuming an address list header (like From or To) -- before it's known what type of IHeaderPart it is (could be an email address, could be a name, or could be a group.)
Tags
Table of Contents
- $charsetConverter : MbWrapper
- $value : string
- __construct() : mixed
- Initializes a token.
- __toString() : string
- Returns the value of the part (which is a string).
- getValue() : string|null
- Returns the part's value.
- ignoreSpacesAfter() : bool
- Returns true if the value is a space.
- ignoreSpacesBefore() : bool
- Returns true if the value is a space.
- isSpace() : bool
- Returns true if the value of the token is equal to a single space.
- convertEncoding() : string
- Ensures the encoding of the passed string is set to UTF-8.
Properties
$charsetConverter
protected
MbWrapper
$charsetConverter
the charset converter used for converting strings in HeaderPart::convertEncoding
$value
protected
string
$value
the value of the part
Methods
__construct()
Initializes a token.
public
__construct(MbWrapper $charsetConverter, string $value) : mixed
Parameters
- $charsetConverter : MbWrapper
- $value : string
-
the token's value
Return values
mixed —__toString()
Returns the value of the part (which is a string).
public
__toString() : string
Return values
string —the value
getValue()
Returns the part's value.
public
getValue() : string|null
Return values
string|null —the value of the part
ignoreSpacesAfter()
Returns true if the value is a space.
public
ignoreSpacesAfter() : bool
Return values
bool —ignoreSpacesBefore()
Returns true if the value is a space.
public
ignoreSpacesBefore() : bool
Return values
bool —isSpace()
Returns true if the value of the token is equal to a single space.
public
isSpace() : bool
Return values
bool —convertEncoding()
Ensures the encoding of the passed string is set to UTF-8.
protected
convertEncoding(string $str[, string $from = 'ISO-8859-1' ][, bool $force = false ]) : string
The method does nothing if the passed $from charset is UTF-8 already, or if $force is set to false and mb_check_encoding for $str returns true for 'UTF-8'.
Parameters
- $str : string
- $from : string = 'ISO-8859-1'
- $force : bool = false
Return values
string —utf-8 string