NumberDigit
in package
implements
ParsableTokenRule
Formats and parses localized number-digit token values.
Table of Contents
Interfaces
- ParsableTokenRule
- Defines parsing behavior for a date-pattern token.
Methods
- __construct() : mixed
- Creates a localized number-digit token rule.
- captureRegex() : string
- Returns the regular-expression fragment for capturing this token.
- format() : string
- Formats the token as localized number digits.
- parse() : int
- Parses localized number digits.
- property() : string
- Returns the semantic calendar-date property represented by this rule.
Methods
__construct()
Creates a localized number-digit token rule.
public
__construct(string $property[, int $minimumDigits = 1 ][, bool $signed = false ]) : mixed
Parameters
- $property : string
-
Calendar-date property name.
- $minimumDigits : int = 1
-
Minimum formatted digit width.
- $signed : bool = false
-
Whether negative values may be captured.
captureRegex()
Returns the regular-expression fragment for capturing this token.
public
captureRegex() : string
Return values
string —Capturing regular-expression fragment.
format()
Formats the token as localized number digits.
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.
parse()
Parses localized number digits.
public
parse(string $value, Calendar $calendar, Locale $locale) : int
Parameters
- $value : string
-
Captured input value.
- $calendar : Calendar
-
Calendar associated with the token scope.
- $locale : Locale
-
Locale definition.
Tags
Return values
int —Parsed semantic value.
property()
Returns the semantic calendar-date property represented by this rule.
public
property() : string
Return values
string —Calendar-date property name.