Class Pattern
Representation of a route pattern.
<?php use ICanBoogie\Routing\Pattern; $pattern = Pattern::from("/blog/<year:\d{4}>-<month:\d{2}>-:slug.html"); echo $pattern; // "/blog/<year:\d{4}>-<month:\d{2}>-:slug.html" $pathname = $pattern->format(array('year' => "2013", 'month' => "07", 'slug' => "test-is-a-test")); echo $pathname; // "/blog/2013-07-this-is-a-test.html" $matching = $pattern->match($pathname, $captured); var_dump($matching); // true var_dump($captured); // array('year' => "2013", 'month' => "07", 'slug' => "test-is-a-test")
Methods summary
public static
boolean
|
|
public static
ICanBoogie\Pattern
|
|
protected
|
#
__construct( string $pattern )
Initializes the |
public
string
|
|
public
|
|
public
string
|
|
public
boolean
|
Magic methods summary
Properties summary
protected
string
|
$pattern |
#
Pattern. |
protected
array
|
$interleaved |
#
Interleaved pattern. |
protected
array
|
$params |
#
Params of the pattern. |
protected
string
|
$regex |
#
Regex of the pattern. |
Magic properties
public read-only
string
|
$pattern |
|
#
The pattern. |
public read-only
array
|
$interleaved |
|
#
The interleaved parts of the pattern. |
public read-only
array
|
$params |
|
#
The names of the pattern params. |
public read-only
string
|
$regex |
|
#
The regex of the pattern. |