1 | <?php |
||
27 | class MatchResult implements \Iterator |
||
28 | { |
||
29 | /** |
||
30 | * |
||
31 | * @var array |
||
32 | */ |
||
33 | protected $response; |
||
34 | /** |
||
35 | * |
||
36 | * @var int |
||
37 | */ |
||
38 | private $current; |
||
39 | /** |
||
40 | * |
||
41 | * @var int |
||
42 | */ |
||
43 | private $count; |
||
44 | |||
45 | /** |
||
46 | * Class contructor. |
||
47 | * |
||
48 | * @param array $regexResponse |
||
49 | */ |
||
50 | 9 | public function __construct(array $regexResponse) |
|
56 | |||
57 | /** |
||
58 | * Returns the number of matches found in the subject string for the executed regex. |
||
59 | * |
||
60 | * @return int |
||
61 | */ |
||
62 | 6 | public function getMatchesCount() |
|
66 | |||
67 | /** |
||
68 | * Returns a match for the executed pattern using it's order in the string. |
||
69 | * |
||
70 | * @param int $index |
||
71 | * |
||
72 | * @throws \OutOfBoundsException |
||
73 | * @return \Mcustiel\PhpSimpleRegex\Match |
||
74 | */ |
||
75 | 7 | public function getMatchAt($index) |
|
83 | |||
84 | // \Iterable implementation |
||
85 | |||
86 | /** |
||
87 | * |
||
88 | * @return \Mcustiel\PhpSimpleRegex\Match |
||
89 | */ |
||
90 | 1 | public function current() |
|
94 | |||
95 | 1 | public function next() |
|
99 | |||
100 | 1 | public function key() |
|
104 | |||
105 | 1 | public function valid() |
|
109 | |||
110 | 1 | public function rewind() |
|
114 | } |
||
115 |