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\Writer\Common\Entity;
   6  
   7  /**
   8   * Entity describing a workbook.
   9   */
  10  final class Workbook
  11  {
  12      /** @var Worksheet[] List of the workbook's sheets */
  13      private array $worksheets = [];
  14  
  15      /** @var string Timestamp based unique ID identifying the workbook */
  16      private string $internalId;
  17  
  18      /**
  19       * Workbook constructor.
  20       */
  21      public function __construct()
  22      {
  23          $this->internalId = uniqid();
  24      }
  25  
  26      /**
  27       * @return Worksheet[]
  28       */
  29      public function getWorksheets(): array
  30      {
  31          return $this->worksheets;
  32      }
  33  
  34      /**
  35       * @param Worksheet[] $worksheets
  36       */
  37      public function setWorksheets(array $worksheets): void
  38      {
  39          $this->worksheets = $worksheets;
  40      }
  41  
  42      public function getInternalId(): string
  43      {
  44          return $this->internalId;
  45      }
  46  }