| 1 | <?php declare(strict_types=1); |
||
| 17 | class ElementIterator extends \FilterIterator |
||
| 18 | { |
||
| 19 | /** |
||
| 20 | * @var string $name Element name to accept |
||
| 21 | */ |
||
| 22 | protected $name; |
||
| 23 | |||
| 24 | /** |
||
| 25 | * @param \Iterator $iterator Set of elements to filter |
||
| 26 | * @param string $name Element name to accept |
||
| 27 | */ |
||
| 28 | public function __construct(\Iterator $iterator, string $name) |
||
| 33 | |||
| 34 | /** |
||
| 35 | * override PHP's count implementation. |
||
| 36 | * @return int |
||
| 37 | */ |
||
| 38 | public function count() : int |
||
| 47 | |||
| 48 | /** |
||
| 49 | * @return boolean True if the current element's name matches the expected one |
||
| 50 | */ |
||
| 51 | public function accept() : bool |
||
| 57 | } |
||
| 58 |