TokenElement
in package
implements
PatternElement
FinalYes
Associates a token rule with its pattern symbol and optional calendar scope.
Tags
Table of Contents
Interfaces
- PatternElement
- Represents an element in a compiled date pattern.
Methods
- __construct() : mixed
- Creates a date-pattern token element.
- calendar() : Calendar|null
- Returns the explicit calendar scope of this token.
- format() : string
- Formats this token for a date.
- rule() : TokenRule
- Returns the token rule.
- symbol() : string
- Returns the pattern token symbol.
Methods
__construct()
Creates a date-pattern token element.
public
__construct(string $symbol, Calendar|null $calendar, TokenRule $rule) : mixed
Parameters
calendar()
Returns the explicit calendar scope of this token.
public
calendar() : Calendar|null
Return values
Calendar|null —Explicit calendar, or null when unscoped.
format()
Formats this token for a date.
public
format(CalendarDate $date, Locale $locale) : string
Parameters
- $date : CalendarDate
-
Date providing the token value.
- $locale : Locale
-
Locale definition.
Tags
Return values
string —Formatted token value.
rule()
Returns the token rule.
public
rule() : TokenRule
Return values
TokenRule —Token rule.
symbol()
Returns the pattern token symbol.
public
symbol() : string
Return values
string —Pattern token symbol.