Total Complexity | 9 |
Total Lines | 52 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
8 | class Stack |
||
9 | { |
||
10 | protected $stack; |
||
11 | |||
12 | 57 | public function __construct() |
|
13 | { |
||
14 | 57 | $this->stack = new SplStack(); |
|
15 | 57 | } |
|
16 | |||
17 | 57 | public function push(StackFrame $frame) |
|
18 | { |
||
19 | 57 | $this->stack->push($frame); |
|
20 | 57 | } |
|
21 | |||
22 | 55 | public function pop() |
|
23 | { |
||
24 | 55 | $this->stack->pop(); |
|
25 | 55 | } |
|
26 | |||
27 | /** @return StackFrame */ |
||
28 | 54 | public function current() |
|
29 | { |
||
30 | 54 | return $this->stack->top(); |
|
31 | } |
||
32 | |||
33 | /** @return StackFrame */ |
||
34 | 1 | public function root() |
|
35 | { |
||
36 | 1 | return $this->stack->bottom(); |
|
37 | } |
||
38 | |||
39 | 53 | public function isEmpty() |
|
40 | { |
||
41 | 53 | return $this->stack->isEmpty(); |
|
42 | } |
||
43 | |||
44 | 5 | public function getDepth() |
|
47 | } |
||
48 | |||
49 | /** |
||
50 | * @return StackFrame[] |
||
51 | */ |
||
52 | 30 | public function frames() |
|
53 | { |
||
54 | 30 | return array_reverse(iterator_to_array($this->stack)); |
|
55 | } |
||
56 | |||
57 | 1 | public function __clone() |
|
60 | 1 | } |
|
61 | } |
||
62 |