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\Writer\Common\Creator;
   4  
   5  use Box\Spout\Writer\Common\Entity\Sheet;
   6  use Box\Spout\Writer\Common\Entity\Workbook;
   7  use Box\Spout\Writer\Common\Entity\Worksheet;
   8  use Box\Spout\Writer\Common\Manager\SheetManager;
   9  
  10  /**
  11   * Class InternalEntityFactory
  12   * Factory to create internal entities
  13   */
  14  class InternalEntityFactory
  15  {
  16      /**
  17       * @return Workbook
  18       */
  19      public function createWorkbook()
  20      {
  21          return new Workbook();
  22      }
  23  
  24      /**
  25       * @param string $worksheetFilePath
  26       * @param Sheet $externalSheet
  27       * @return Worksheet
  28       */
  29      public function createWorksheet($worksheetFilePath, Sheet $externalSheet)
  30      {
  31          return new Worksheet($worksheetFilePath, $externalSheet);
  32      }
  33  
  34      /**
  35       * @param int $sheetIndex Index of the sheet, based on order in the workbook (zero-based)
  36       * @param string $associatedWorkbookId ID of the sheet's associated workbook
  37       * @param SheetManager $sheetManager To manage sheets
  38       * @return Sheet
  39       */
  40      public function createSheet($sheetIndex, $associatedWorkbookId, $sheetManager)
  41      {
  42          return new Sheet($sheetIndex, $associatedWorkbookId, $sheetManager);
  43      }
  44  
  45      /**
  46       * @return \ZipArchive
  47       */
  48      public function createZipArchive()
  49      {
  50          return new \ZipArchive();
  51      }
  52  }