PatternCompiler
in package
Compiles date-pattern strings.
A pattern combines date-field tokens with text that must appear as written. Known token symbols select date fields. Other characters are treated as literal text. Single or double quotes can group literal text, and a backslash escapes the following character.
A calendar scope is a bracketed sub-pattern evaluated in another calendar.
Scope syntax is [Calendar:pattern], for example [Gregorian:Y-m-d].
Scope names match Calendar case names case-insensitively. Scopes cannot be
nested.
Tags
Table of Contents
Methods
- __construct() : mixed
- Creates a pattern compiler.
- compile() : CompiledPattern
- Compiles a date pattern.
- revision() : int
- Returns the current compiler revision.
- shared() : self
- Returns the shared pattern compiler.
Methods
__construct()
Creates a pattern compiler.
public
__construct([TokenRegistry|null $tokens = null ]) : mixed
Parameters
- $tokens : TokenRegistry|null = null
-
Optional token registry. If not provided, the shared registry is used.
Tags
compile()
Compiles a date pattern.
public
compile(string $pattern) : CompiledPattern
Parameters
- $pattern : string
-
Pattern to compile.
Tags
Return values
CompiledPattern —Compiled pattern.
revision()
Returns the current compiler revision.
public
revision() : int
Return values
int —Compiler revision.
shared()
Returns the shared pattern compiler.
public
static shared() : self
Return values
self —Pattern compiler.