1 | <?php |
||
26 | class Match |
||
27 | { |
||
28 | /** |
||
29 | * |
||
30 | * @var array |
||
31 | */ |
||
32 | protected $element; |
||
33 | |||
34 | /** |
||
35 | * Class constructor. |
||
36 | * |
||
37 | * @param array $responseElement |
||
38 | */ |
||
39 | 14 | public function __construct(array $responseElement) |
|
43 | |||
44 | /** |
||
45 | * Returns the full match string that matches the whole pattern. Null if no match found. |
||
46 | * |
||
47 | * @return null|string |
||
48 | */ |
||
49 | 9 | public function getFullMatch() |
|
53 | |||
54 | /** |
||
55 | * Returns the offset of the string that matches the whole pattern in the subject |
||
56 | * string, null if no match found. |
||
57 | * |
||
58 | * @return null|int |
||
59 | */ |
||
60 | 1 | public function getOffset() |
|
64 | |||
65 | /** |
||
66 | * Returns the string matching a subpattern of a pattern, giving it's index. |
||
67 | * |
||
68 | * @param int $index |
||
69 | * |
||
70 | * @throws \OutOfBoundsException |
||
71 | * @return string |
||
72 | */ |
||
73 | 8 | public function getSubMatchAt($index) |
|
79 | |||
80 | /** |
||
81 | * Returns the string matching a subpattern of a pattern, giving it's index. If there |
||
82 | * is no submatch at that index, return the default value. |
||
83 | * |
||
84 | * @param int $index |
||
85 | * |
||
86 | * @return string|mixed |
||
87 | */ |
||
88 | 1 | public function getSubMatchOrDefaultAt($index, $default = null) |
|
92 | |||
93 | /** |
||
94 | * Returns the offset of the string matching a subpattern of a pattern, giving it's index. |
||
95 | * |
||
96 | * @param int $index |
||
97 | * |
||
98 | * @throws \OutOfBoundsException |
||
99 | * @return int |
||
100 | */ |
||
101 | 6 | public function getSubmatchOffsetAt($index) |
|
106 | |||
107 | /** |
||
108 | * Validates the index of a subpattern. |
||
109 | * |
||
110 | * @param int $index |
||
111 | * @throws \OutOfBoundsException |
||
112 | */ |
||
113 | 9 | private function validateIndex($index) |
|
121 | } |
||
122 |