1 | <?php |
---|
2 | /** |
---|
3 | * PHPExcel |
---|
4 | * |
---|
5 | * Copyright (c) 2006 - 2014 PHPExcel |
---|
6 | * |
---|
7 | * This library is free software; you can redistribute it and/or |
---|
8 | * modify it under the terms of the GNU Lesser General Public |
---|
9 | * License as published by the Free Software Foundation; either |
---|
10 | * version 2.1 of the License, or (at your option) any later version. |
---|
11 | * |
---|
12 | * This library is distributed in the hope that it will be useful, |
---|
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
15 | * Lesser General Public License for more details. |
---|
16 | * |
---|
17 | * You should have received a copy of the GNU Lesser General Public |
---|
18 | * License along with this library; if not, write to the Free Software |
---|
19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
---|
20 | * |
---|
21 | * @category PHPExcel |
---|
22 | * @package PHPExcel_Calculation |
---|
23 | * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) |
---|
24 | * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL |
---|
25 | * @version 1.8.0, 2014-03-02 |
---|
26 | */ |
---|
27 | |
---|
28 | |
---|
29 | /** |
---|
30 | * PHPExcel_CalcEngine_CyclicReferenceStack |
---|
31 | * |
---|
32 | * @category PHPExcel_CalcEngine_CyclicReferenceStack |
---|
33 | * @package PHPExcel_Calculation |
---|
34 | * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) |
---|
35 | */ |
---|
36 | class PHPExcel_CalcEngine_CyclicReferenceStack { |
---|
37 | |
---|
38 | /** |
---|
39 | * The call stack for calculated cells |
---|
40 | * |
---|
41 | * @var mixed[] |
---|
42 | */ |
---|
43 | private $_stack = array(); |
---|
44 | |
---|
45 | |
---|
46 | /** |
---|
47 | * Return the number of entries on the stack |
---|
48 | * |
---|
49 | * @return integer |
---|
50 | */ |
---|
51 | public function count() { |
---|
52 | return count($this->_stack); |
---|
53 | } |
---|
54 | |
---|
55 | /** |
---|
56 | * Push a new entry onto the stack |
---|
57 | * |
---|
58 | * @param mixed $value |
---|
59 | */ |
---|
60 | public function push($value) { |
---|
61 | $this->_stack[] = $value; |
---|
62 | } // function push() |
---|
63 | |
---|
64 | /** |
---|
65 | * Pop the last entry from the stack |
---|
66 | * |
---|
67 | * @return mixed |
---|
68 | */ |
---|
69 | public function pop() { |
---|
70 | return array_pop($this->_stack); |
---|
71 | } // function pop() |
---|
72 | |
---|
73 | /** |
---|
74 | * Test to see if a specified entry exists on the stack |
---|
75 | * |
---|
76 | * @param mixed $value The value to test |
---|
77 | */ |
---|
78 | public function onStack($value) { |
---|
79 | return in_array($value, $this->_stack); |
---|
80 | } |
---|
81 | |
---|
82 | /** |
---|
83 | * Clear the stack |
---|
84 | */ |
---|
85 | public function clear() { |
---|
86 | $this->_stack = array(); |
---|
87 | } // function push() |
---|
88 | |
---|
89 | /** |
---|
90 | * Return an array of all entries on the stack |
---|
91 | * |
---|
92 | * @return mixed[] |
---|
93 | */ |
---|
94 | public function showStack() { |
---|
95 | return $this->_stack; |
---|
96 | } |
---|
97 | |
---|
98 | } // class PHPExcel_CalcEngine_CyclicReferenceStack |
---|