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 311 and 400] [Versions 311 and 401] [Versions 311 and 402] [Versions 311 and 403] [Versions 39 and 311]

   1  <?php
   2  
   3  namespace PhpOffice\PhpSpreadsheet\Worksheet;
   4  
   5  use PhpOffice\PhpSpreadsheet\Exception as PhpSpreadsheetException;
   6  
   7  abstract class Dimension
   8  {
   9      /**
  10       * Visible?
  11       *
  12       * @var bool
  13       */
  14      private $visible = true;
  15  
  16      /**
  17       * Outline level.
  18       *
  19       * @var int
  20       */
  21      private $outlineLevel = 0;
  22  
  23      /**
  24       * Collapsed.
  25       *
  26       * @var bool
  27       */
  28      private $collapsed = false;
  29  
  30      /**
  31       * Index to cellXf. Null value means row has no explicit cellXf format.
  32       *
  33       * @var null|int
  34       */
  35      private $xfIndex;
  36  
  37      /**
  38       * Create a new Dimension.
  39       *
  40       * @param int $initialValue Numeric row index
  41       */
  42      public function __construct($initialValue = null)
  43      {
  44          // set dimension as unformatted by default
  45          $this->xfIndex = $initialValue;
  46      }
  47  
  48      /**
  49       * Get Visible.
  50       *
  51       * @return bool
  52       */
  53      public function getVisible()
  54      {
  55          return $this->visible;
  56      }
  57  
  58      /**
  59       * Set Visible.
  60       *
  61       * @param bool $pValue
  62       *
  63       * @return $this
  64       */
  65      public function setVisible($pValue)
  66      {
  67          $this->visible = (bool) $pValue;
  68  
  69          return $this;
  70      }
  71  
  72      /**
  73       * Get Outline Level.
  74       *
  75       * @return int
  76       */
  77      public function getOutlineLevel()
  78      {
  79          return $this->outlineLevel;
  80      }
  81  
  82      /**
  83       * Set Outline Level.
  84       * Value must be between 0 and 7.
  85       *
  86       * @param int $pValue
  87       *
  88       * @return $this
  89       */
  90      public function setOutlineLevel($pValue)
  91      {
  92          if ($pValue < 0 || $pValue > 7) {
  93              throw new PhpSpreadsheetException('Outline level must range between 0 and 7.');
  94          }
  95  
  96          $this->outlineLevel = $pValue;
  97  
  98          return $this;
  99      }
 100  
 101      /**
 102       * Get Collapsed.
 103       *
 104       * @return bool
 105       */
 106      public function getCollapsed()
 107      {
 108          return $this->collapsed;
 109      }
 110  
 111      /**
 112       * Set Collapsed.
 113       *
 114       * @param bool $pValue
 115       *
 116       * @return $this
 117       */
 118      public function setCollapsed($pValue)
 119      {
 120          $this->collapsed = (bool) $pValue;
 121  
 122          return $this;
 123      }
 124  
 125      /**
 126       * Get index to cellXf.
 127       *
 128       * @return int
 129       */
 130      public function getXfIndex()
 131      {
 132          return $this->xfIndex;
 133      }
 134  
 135      /**
 136       * Set index to cellXf.
 137       *
 138       * @param int $pValue
 139       *
 140       * @return $this
 141       */
 142      public function setXfIndex($pValue)
 143      {
 144          $this->xfIndex = $pValue;
 145  
 146          return $this;
 147      }
 148  
 149      /**
 150       * Implement PHP __clone to create a deep clone, not just a shallow copy.
 151       */
 152      public function __clone()
 153      {
 154          $vars = get_object_vars($this);
 155          foreach ($vars as $key => $value) {
 156              if (is_object($value)) {
 157                  $this->$key = clone $value;
 158              } else {
 159                  $this->$key = $value;
 160              }
 161          }
 162      }
 163  }