1 | <?php |
||
22 | class Stack implements \ArrayAccess, \Iterator, \Countable |
||
23 | { |
||
24 | |||
25 | /** |
||
26 | * @var Reference[] |
||
27 | */ |
||
28 | private $stack; |
||
29 | |||
30 | /** |
||
31 | * @var int |
||
32 | */ |
||
33 | private $pos; |
||
34 | |||
35 | /** |
||
36 | * Stack constructor. |
||
37 | */ |
||
38 | 4 | public function __construct() |
|
42 | |||
43 | /** |
||
44 | * @param $data |
||
45 | */ |
||
46 | 4 | public function takeReference(&$data) |
|
54 | |||
55 | /** |
||
56 | * @inheritDoc |
||
57 | */ |
||
58 | public function offsetExists($offset) |
||
62 | |||
63 | /** |
||
64 | * @inheritDoc |
||
65 | */ |
||
66 | 1 | public function offsetGet($offset) |
|
70 | |||
71 | /** |
||
72 | * @inheritDoc |
||
73 | */ |
||
74 | 1 | public function offsetSet($offset, $value) |
|
80 | |||
81 | /** |
||
82 | * @inheritDoc |
||
83 | */ |
||
84 | 1 | public function offsetUnset($offset) |
|
88 | |||
89 | |||
90 | /** |
||
91 | * @inheritDoc |
||
92 | */ |
||
93 | 1 | public function current() |
|
97 | |||
98 | /** |
||
99 | * @inheritDoc |
||
100 | */ |
||
101 | 1 | public function next() |
|
105 | |||
106 | /** |
||
107 | * @inheritDoc |
||
108 | */ |
||
109 | 1 | public function key() |
|
113 | |||
114 | /** |
||
115 | * @inheritDoc |
||
116 | */ |
||
117 | 1 | public function valid() |
|
121 | |||
122 | /** |
||
123 | * @inheritDoc |
||
124 | */ |
||
125 | 1 | public function rewind() |
|
129 | |||
130 | /** |
||
131 | * @return \twhiston\twLib\Reference\Reference |
||
132 | */ |
||
133 | 2 | public function &top() |
|
137 | |||
138 | /** |
||
139 | * Remove the Reference from the top of the stack |
||
140 | */ |
||
141 | 2 | public function pop() |
|
145 | |||
146 | /** |
||
147 | * Remove the Reference from the bottom of the stack |
||
148 | */ |
||
149 | 1 | public function shift() |
|
153 | |||
154 | /** |
||
155 | * @inheritDoc |
||
156 | */ |
||
157 | 2 | public function count() |
|
161 | |||
162 | |||
163 | } |