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.
   1  <?php
   2  
   3  namespace Box\Spout\Reader\XLSX;
   4  
   5  use Box\Spout\Reader\SheetInterface;
   6  
   7  /**
   8   * Class Sheet
   9   * Represents a sheet within a XLSX file
  10   */
  11  class Sheet implements SheetInterface
  12  {
  13      /** @var \Box\Spout\Reader\XLSX\RowIterator To iterate over sheet's rows */
  14      protected $rowIterator;
  15  
  16      /** @var int Index of the sheet, based on order in the workbook (zero-based) */
  17      protected $index;
  18  
  19      /** @var string Name of the sheet */
  20      protected $name;
  21  
  22      /** @var bool Whether the sheet was the active one */
  23      protected $isActive;
  24  
  25      /** @var bool Whether the sheet is visible */
  26      protected $isVisible;
  27  
  28      /**
  29       * @param RowIterator $rowIterator The corresponding row iterator
  30       * @param int $sheetIndex Index of the sheet, based on order in the workbook (zero-based)
  31       * @param string $sheetName Name of the sheet
  32       * @param bool $isSheetActive Whether the sheet was defined as active
  33       * @param bool $isSheetVisible Whether the sheet is visible
  34       */
  35      public function __construct($rowIterator, $sheetIndex, $sheetName, $isSheetActive, $isSheetVisible)
  36      {
  37          $this->rowIterator = $rowIterator;
  38          $this->index = $sheetIndex;
  39          $this->name = $sheetName;
  40          $this->isActive = $isSheetActive;
  41          $this->isVisible = $isSheetVisible;
  42      }
  43  
  44      /**
  45       * @return \Box\Spout\Reader\XLSX\RowIterator
  46       */
  47      public function getRowIterator()
  48      {
  49          return $this->rowIterator;
  50      }
  51  
  52      /**
  53       * @return int Index of the sheet, based on order in the workbook (zero-based)
  54       */
  55      public function getIndex()
  56      {
  57          return $this->index;
  58      }
  59  
  60      /**
  61       * @return string Name of the sheet
  62       */
  63      public function getName()
  64      {
  65          return $this->name;
  66      }
  67  
  68      /**
  69       * @return bool Whether the sheet was defined as active
  70       */
  71      public function isActive()
  72      {
  73          return $this->isActive;
  74      }
  75  
  76      /**
  77       * @return bool Whether the sheet is visible
  78       */
  79      public function isVisible()
  80      {
  81          return $this->isVisible;
  82      }
  83  }