Naify\Router\RoutePattern クラス
ルート記法を解析し、照合とURL生成で同じ構造を使う
regex 内の文字クラス・エスケープ・量指定子はルートの区切りと分離する。 ルートのリテラルな { } [ ] とバックスラッシュは \ でエスケープする。
プロパティ
| 名前 | 型 | 説明 |
|---|---|---|
private
$parts
|
?array |
text / parameter / optional の構文要素 |
private
$regex
|
string |
|
private
$pattern
|
string |
ルート定義文字列 |
メソッド
| メソッド | 説明 |
|---|---|
public
__construct(string $pattern):
|
|
public
getRegex(): string
|
|
public
buildPath(array $data): string
|
|
private
getParts(): array
|
|
private
parse(int $offset, array $names, bool $optional): array
|
|
private
readConstraint(int $offset, bool $wildcard): string
|
|
private
skipCharacterClass(int $offset): void
|
文字クラス内の ]・POSIXクラス・エスケープを読み飛ばす |
private
skipRegexEscape(int $offset): void
|
regex と文字クラスに共通する引用・制御文字エスケープを読む |
private
compile(array $parts, string $delimiter): string
|
|
private
render(array $parts, array $data, bool $optional): ?string
|