PluginProbe
Packeta / 2.1
Packeta v2.1
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 / deps / nette / component-model / src / ComponentModel / RecursiveComponentIterator.php

RecursiveComponentIterator.php in Packeta 2.1, at deps/nette/component-model/src/ComponentModel/RecursiveComponentIterator.php

38 lines 866 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 Nette Framework (https://nette.org)
5 * Copyright (c) 2004 David Grudl (https://davidgrudl.com)
6 */
7 declare (strict_types=1);
8 namespace Packetery\Nette\ComponentModel;
9
10 /**
11 * Recursive component iterator. See Container::getComponents().
12 * @internal
13 */
14 final class RecursiveComponentIterator extends \RecursiveArrayIterator implements \Countable
15 {
16 /**
17 * Has the current element has children?
18 */
19 public function hasChildren() : bool
20 {
21 return $this->current() instanceof IContainer;
22 }
23 /**
24 * The sub-iterator for the current element.
25 */
26 public function getChildren() : self
27 {
28 return $this->current()->getComponents();
29 }
30 /**
31 * Returns the count of elements.
32 */
33 public function count() : int
34 {
35 return \iterator_count($this);
36 }
37 }
38