visualizer
/
vendor
/
phpoffice
/
phpspreadsheet
/
src
/
PhpSpreadsheet
/
Calculation
/
Engine
/
CyclicReferenceStack.php
CyclicReferenceStack.php in Visualizer – Tables & Charts Manager with Built-in AI Generator 3.10.8, at vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engine/CyclicReferenceStack.php
| 1 | <?php |
| 2 | |
| 3 | namespace PhpOffice\PhpSpreadsheet\Calculation\Engine; |
| 4 | |
| 5 | class CyclicReferenceStack |
| 6 | { |
| 7 | /** |
| 8 | * The call stack for calculated cells. |
| 9 | * |
| 10 | * @var mixed[] |
| 11 | */ |
| 12 | private $stack = []; |
| 13 | |
| 14 | /** |
| 15 | * Return the number of entries on the stack. |
| 16 | * |
| 17 | * @return int |
| 18 | */ |
| 19 | public function count() |
| 20 | { |
| 21 | return count($this->stack); |
| 22 | } |
| 23 | |
| 24 | /** |
| 25 | * Push a new entry onto the stack. |
| 26 | * |
| 27 | * @param mixed $value |
| 28 | */ |
| 29 | public function push($value) |
| 30 | { |
| 31 | $this->stack[$value] = $value; |
| 32 | } |
| 33 | |
| 34 | /** |
| 35 | * Pop the last entry from the stack. |
| 36 | * |
| 37 | * @return mixed |
| 38 | */ |
| 39 | public function pop() |
| 40 | { |
| 41 | return array_pop($this->stack); |
| 42 | } |
| 43 | |
| 44 | /** |
| 45 | * Test to see if a specified entry exists on the stack. |
| 46 | * |
| 47 | * @param mixed $value The value to test |
| 48 | * |
| 49 | * @return bool |
| 50 | */ |
| 51 | public function onStack($value) |
| 52 | { |
| 53 | return isset($this->stack[$value]); |
| 54 | } |
| 55 | |
| 56 | /** |
| 57 | * Clear the stack. |
| 58 | */ |
| 59 | public function clear() |
| 60 | { |
| 61 | $this->stack = []; |
| 62 | } |
| 63 | |
| 64 | /** |
| 65 | * Return an array of all entries on the stack. |
| 66 | * |
| 67 | * @return mixed[] |
| 68 | */ |
| 69 | public function showStack() |
| 70 | { |
| 71 | return $this->stack; |
| 72 | } |
| 73 | } |
| 74 |