Search moodle.org's
Developer Documentation

See Release Notes

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