Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.

Differences Between: [Versions 310 and 311] [Versions 39 and 311]

   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): void
  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(): void
  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  }