Total Complexity | 4 |
Total Lines | 38 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
14 | class StringIterator extends \ArrayIterator |
||
15 | { |
||
16 | /** |
||
17 | * StringIterator constructor. |
||
18 | * |
||
19 | * @param string $string |
||
20 | */ |
||
21 | 12 | public function __construct(string $string = '') |
|
22 | { |
||
23 | 12 | parent::__construct(str_split($string)); |
|
24 | 12 | } |
|
25 | |||
26 | /** |
||
27 | * @param string $value |
||
28 | * |
||
29 | * @return bool |
||
30 | */ |
||
31 | 9 | public function is(string $value): bool |
|
32 | { |
||
33 | 9 | return $value === $this->current(); |
|
34 | } |
||
35 | |||
36 | /** |
||
37 | * @param string $value |
||
38 | * |
||
39 | * @return bool |
||
40 | */ |
||
41 | 12 | public function isNot(string $value): bool |
|
44 | } |
||
45 | |||
46 | /** |
||
47 | * @return string |
||
48 | */ |
||
49 | 3 | public function __toString() |
|
52 | } |
||
53 | } |
||
54 |