Mercurial > hg > isophonics-drupal-site
comparison vendor/phar-io/manifest/src/xml/ElementCollection.php @ 14:1fec387a4317
Update Drupal core to 8.5.2 via Composer
author | Chris Cannam |
---|---|
date | Mon, 23 Apr 2018 09:46:53 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
13:5fb285c0d0e3 | 14:1fec387a4317 |
---|---|
1 <?php | |
2 /* | |
3 * This file is part of PharIo\Manifest. | |
4 * | |
5 * (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de> | |
6 * | |
7 * For the full copyright and license information, please view the LICENSE | |
8 * file that was distributed with this source code. | |
9 */ | |
10 | |
11 namespace PharIo\Manifest; | |
12 | |
13 use DOMElement; | |
14 use DOMNodeList; | |
15 | |
16 abstract class ElementCollection implements \Iterator { | |
17 /** | |
18 * @var DOMNodeList | |
19 */ | |
20 private $nodeList; | |
21 | |
22 private $position; | |
23 | |
24 /** | |
25 * ElementCollection constructor. | |
26 * | |
27 * @param DOMNodeList $nodeList | |
28 */ | |
29 public function __construct(DOMNodeList $nodeList) { | |
30 $this->nodeList = $nodeList; | |
31 $this->position = 0; | |
32 } | |
33 | |
34 abstract public function current(); | |
35 | |
36 /** | |
37 * @return DOMElement | |
38 */ | |
39 protected function getCurrentElement() { | |
40 return $this->nodeList->item($this->position); | |
41 } | |
42 | |
43 public function next() { | |
44 $this->position++; | |
45 } | |
46 | |
47 public function key() { | |
48 return $this->position; | |
49 } | |
50 | |
51 public function valid() { | |
52 return $this->position < $this->nodeList->length; | |
53 } | |
54 | |
55 public function rewind() { | |
56 $this->position = 0; | |
57 } | |
58 } |