ParseCapture
in package
FinalYes
Represents a token capture in a compiled parse pattern.
Tags
Table of Contents
Methods
- __construct() : mixed
- Creates a parse capture.
- calendarScope() : Calendar|null
- Returns the explicit calendar scope of this capture.
- parse() : int
- Parses the captured value into a calendar-date field value.
- property() : string
- Returns the semantic calendar-date property represented by this capture.
- regex() : string
- Returns the regular-expression fragment for capturing this token.
Methods
__construct()
Creates a parse capture.
public
__construct(Calendar|null $calendarScope, ParsableTokenRule $rule) : mixed
Parameters
- $calendarScope : Calendar|null
-
Explicit calendar scope, or null when unscoped.
- $rule : ParsableTokenRule
-
Parsable token rule.
calendarScope()
Returns the explicit calendar scope of this capture.
public
calendarScope() : Calendar|null
Return values
Calendar|null —Explicit calendar scope, or null when unscoped.
parse()
Parses the captured value into a calendar-date field value.
public
parse(string $value, Calendar $defaultCalendar, Locale $locale) : int
Parameters
- $value : string
-
Captured input value.
- $defaultCalendar : Calendar
-
Calendar used when this capture is unscoped.
- $locale : Locale
-
Locale definition.
Tags
Return values
int —Parsed field value.
property()
Returns the semantic calendar-date property represented by this capture.
public
property() : string
Return values
string —Calendar-date property name.
regex()
Returns the regular-expression fragment for capturing this token.
public
regex() : string
Return values
string —Capturing regular-expression fragment.