PluginProbe
Packeta / 1.2.6
Packeta v1.2.6
2.3.2 2.3.1 trunk 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.3.0 1.3.1 1.3.2 1.4 1.4.1 1.4.2 1.4.3 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 All 56 releases
packeta / packetery_vendor / nette / component-model / src / ComponentModel / RecursiveComponentIterator.php

RecursiveComponentIterator.php in Packeta 1.2.6, at packetery_vendor/nette/component-model/src/ComponentModel/RecursiveComponentIterator.php

46 lines 872 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * This file is part of the PacketeryNette Framework (https://nette.org)
5 * Copyright (c) 2004 David Grudl (https://davidgrudl.com)
6 */
7
8 declare(strict_types=1);
9
10 namespace PacketeryNette\ComponentModel;
11
12
13 /**
14 * Recursive component iterator. See Container::getComponents().
15 * @internal
16 */
17 final class RecursiveComponentIterator extends \RecursiveArrayIterator implements \Countable
18 {
19 /**
20 * Has the current element has children?
21 */
22 public function hasChildren(): bool
23 {
24 return $this->current() instanceof IContainer;
25 }
26
27
28 /**
29 * The sub-iterator for the current element.
30 * @return \RecursiveIterator<int|string,IComponent>
31 */
32 public function getChildren(): \RecursiveIterator
33 {
34 return $this->current()->getComponents();
35 }
36
37
38 /**
39 * Returns the count of elements.
40 */
41 public function count(): int
42 {
43 return iterator_count($this);
44 }
45 }
46