Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.
   1  <?php
   2  
   3  namespace Box\Spout\Reader\CSV;
   4  
   5  use Box\Spout\Reader\SheetInterface;
   6  
   7  /**
   8   * Class Sheet
   9   */
  10  class Sheet implements SheetInterface
  11  {
  12      /** @var \Box\Spout\Reader\CSV\RowIterator To iterate over the CSV's rows */
  13      protected $rowIterator;
  14  
  15      /**
  16       * @param RowIterator $rowIterator Corresponding row iterator
  17       */
  18      public function __construct(RowIterator $rowIterator)
  19      {
  20          $this->rowIterator = $rowIterator;
  21      }
  22  
  23      /**
  24       * @return \Box\Spout\Reader\CSV\RowIterator
  25       */
  26      public function getRowIterator()
  27      {
  28          return $this->rowIterator;
  29      }
  30  
  31      /**
  32       * @return int Index of the sheet
  33       */
  34      public function getIndex()
  35      {
  36          return 0;
  37      }
  38  
  39      /**
  40       * @return string Name of the sheet - empty string since CSV does not support that
  41       */
  42      public function getName()
  43      {
  44          return '';
  45      }
  46  
  47      /**
  48       * @return bool Always TRUE as there is only one sheet
  49       */
  50      public function isActive()
  51      {
  52          return true;
  53      }
  54  
  55      /**
  56       * @return bool Always TRUE as the only sheet is always visible
  57       */
  58      public function isVisible()
  59      {
  60          return true;
  61      }
  62  }