Subversion-Projekte lars-tiefland.laravel_shop

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
365 lars 1
<?php declare(strict_types=1);
2
namespace PHPHtmlParser\Dom;
3
 
4
use Countable;
5
use ArrayIterator;
6
use IteratorAggregate;
7
 
8
/**
9
 * Dom node object which will allow users to use it as
10
 * an array.
11
 */
12
abstract class ArrayNode extends AbstractNode implements IteratorAggregate, Countable
13
{
14
 
15
    /**
16
     * Gets the iterator
17
     *
18
     * @return ArrayIterator
19
     */
20
    public function getIterator(): ArrayIterator
21
    {
22
        return new ArrayIterator($this->getIteratorArray());
23
    }
24
 
25
    /**
26
     * Returns the count of the iterator array.
27
     *
28
     * @return int
29
     */
30
    public function count(): int
31
    {
32
        return count($this->getIteratorArray());
33
    }
34
 
35
    /**
36
     * Returns the array to be used the the iterator.
37
     *
38
     * @return array
39
     */
40
    abstract protected function getIteratorArray(): array;
41
}