PluginProbe
WCPOS – Point of Sale (POS) plugin for WooCommerce / 1.10.20
WCPOS – Point of Sale (POS) plugin for WooCommerce v1.10.20
1.10.20 1.10.19 1.10.18 1.10.17 1.10.16 1.10.15 1.10.13 1.10.14 1.10.12 1.10.11 1.10.10 1.10.9 1.10.8 untagged-3d9b7ccddc54df87c672 1.10.7 1.10.6 1.10.5 1.10.3 1.10.4 1.10.2 1.10.1 1.10.0 1.9.17 1.9.15 1.9.16 All 164 releases
woocommerce-pos / vendor_prefixed / dompdf / dompdf / src / Frame / FrameTreeIterator.php

FrameTreeIterator.php in WCPOS – Point of Sale (POS) plugin for WooCommerce 1.10.20, at vendor_prefixed/dompdf/dompdf/src/Frame/FrameTreeIterator.php

80 lines 1.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * @package dompdf
5 * @link https://github.com/dompdf/dompdf
6 * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
7 */
8 namespace WCPOS\Vendor\Dompdf\Frame;
9
10 use Iterator;
11 use WCPOS\Vendor\Dompdf\Frame;
12 /**
13 * Pre-order Iterator
14 *
15 * Returns frames in preorder traversal order (parent then children)
16 *
17 * @package dompdf
18 */
19 class FrameTreeIterator implements Iterator
20 {
21 /**
22 * @var Frame
23 */
24 protected $_root;
25 /**
26 * @var Frame[]
27 */
28 protected $_stack = [];
29 /**
30 * @var int
31 */
32 protected $_num;
33 /**
34 * @param Frame $root
35 */
36 public function __construct(Frame $root)
37 {
38 $this->_stack[] = $this->_root = $root;
39 $this->_num = 0;
40 }
41 public function rewind() : void
42 {
43 $this->_stack = [$this->_root];
44 $this->_num = 0;
45 }
46 /**
47 * @return bool
48 */
49 public function valid() : bool
50 {
51 return \count($this->_stack) > 0;
52 }
53 /**
54 * @return int
55 */
56 public function key() : int
57 {
58 return $this->_num;
59 }
60 /**
61 * @return Frame
62 */
63 public function current() : Frame
64 {
65 return \end($this->_stack);
66 }
67 public function next() : void
68 {
69 $b = \array_pop($this->_stack);
70 $this->_num++;
71 // Push all children onto the stack in reverse order
72 if ($c = $b->get_last_child()) {
73 $this->_stack[] = $c;
74 while ($c = $c->get_prev_sibling()) {
75 $this->_stack[] = $c;
76 }
77 }
78 }
79 }
80