| Total Complexity | 6 |
| Total Lines | 49 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 16 | class StringIterator extends \ArrayIterator |
||
| 17 | { |
||
| 18 | /** |
||
| 19 | * StringIterator constructor. |
||
| 20 | * |
||
| 21 | * @param string $string |
||
| 22 | */ |
||
| 23 | 38 | public function __construct(string $string = '') |
|
| 24 | { |
||
| 25 | 38 | parent::__construct(str_split($string)); |
|
| 26 | 38 | } |
|
| 27 | |||
| 28 | /** |
||
| 29 | * @param string $value |
||
| 30 | * |
||
| 31 | * @return bool |
||
| 32 | */ |
||
| 33 | 38 | public function is(string $value): bool |
|
| 34 | { |
||
| 35 | 38 | return $value === $this->current(); |
|
| 36 | } |
||
| 37 | |||
| 38 | /** |
||
| 39 | * @param string $value |
||
| 40 | * |
||
| 41 | * @return bool |
||
| 42 | */ |
||
| 43 | 38 | public function isNot(string $value): bool |
|
| 46 | } |
||
| 47 | |||
| 48 | 3 | public function getRemainingAsString(): string |
|
| 49 | { |
||
| 50 | 3 | $string = ''; |
|
| 51 | 3 | while ($this->valid()) { |
|
| 52 | 3 | $string .= $this->current(); |
|
| 53 | 3 | $this->next(); |
|
| 54 | } |
||
| 55 | |||
| 56 | 3 | return $string; |
|
| 57 | } |
||
| 58 | |||
| 59 | /** |
||
| 60 | * @return string |
||
| 61 | */ |
||
| 62 | 11 | public function __toString() |
|
| 65 | } |
||
| 66 | } |
||
| 67 |