1 | <?php |
||
12 | class Expression |
||
13 | { |
||
14 | /** |
||
15 | * Raw definition |
||
16 | * @var string |
||
17 | */ |
||
18 | private $raw; |
||
19 | |||
20 | /** |
||
21 | * Rule pattern |
||
22 | * @var string |
||
23 | */ |
||
24 | private $pattern; |
||
25 | |||
26 | /** |
||
27 | * Initialize expression |
||
28 | * @param string $rule |
||
29 | */ |
||
30 | public function __construct($rule) |
||
34 | |||
35 | /** |
||
36 | * Retrieve the raw rule definition |
||
37 | * @return string |
||
38 | */ |
||
39 | public function getRaw() |
||
43 | |||
44 | /** |
||
45 | * Transform current pattern to be used for matching |
||
46 | * @return string |
||
47 | */ |
||
48 | private function build() |
||
62 | |||
63 | /** |
||
64 | * Check if current expression is contained in another |
||
65 | * @param Expression $exp |
||
66 | * @return boolean |
||
67 | */ |
||
68 | public function contained(Expression $exp) |
||
72 | |||
73 | /** |
||
74 | * Check if current expression contains another |
||
75 | * @param Expression $exp |
||
76 | * @return boolean |
||
77 | */ |
||
78 | public function contains(Expression $exp) |
||
82 | |||
83 | /** |
||
84 | * Retrieve the regex pattern corresponding to the Expression |
||
85 | * @return string |
||
86 | */ |
||
87 | public function getPattern() |
||
92 | |||
93 | /** |
||
94 | * Transform expression to string |
||
95 | * @return string |
||
96 | */ |
||
97 | public function __toString() |
||
101 | } |
||
102 |