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\Writer\ODS\Creator;
   4  
   5  use Box\Spout\Common\Helper\Escaper;
   6  use Box\Spout\Common\Helper\StringHelper;
   7  use Box\Spout\Common\Manager\OptionsManagerInterface;
   8  use Box\Spout\Writer\Common\Creator\InternalEntityFactory;
   9  use Box\Spout\Writer\Common\Entity\Options;
  10  use Box\Spout\Writer\Common\Helper\ZipHelper;
  11  use Box\Spout\Writer\ODS\Helper\FileSystemHelper;
  12  
  13  /**
  14   * Class HelperFactory
  15   * Factory for helpers needed by the ODS Writer
  16   */
  17  class HelperFactory extends \Box\Spout\Common\Creator\HelperFactory
  18  {
  19      /**
  20       * @param OptionsManagerInterface $optionsManager
  21       * @param InternalEntityFactory $entityFactory
  22       * @return FileSystemHelper
  23       */
  24      public function createSpecificFileSystemHelper(OptionsManagerInterface $optionsManager, InternalEntityFactory $entityFactory)
  25      {
  26          $tempFolder = $optionsManager->getOption(Options::TEMP_FOLDER);
  27          $zipHelper = $this->createZipHelper($entityFactory);
  28  
  29          return new FileSystemHelper($tempFolder, $zipHelper);
  30      }
  31  
  32      /**
  33       * @param $entityFactory
  34       * @return ZipHelper
  35       */
  36      private function createZipHelper($entityFactory)
  37      {
  38          return new ZipHelper($entityFactory);
  39      }
  40  
  41      /**
  42       * @return Escaper\ODS
  43       */
  44      public function createStringsEscaper()
  45      {
  46          return new Escaper\ODS();
  47      }
  48  
  49      /**
  50       * @return StringHelper
  51       */
  52      public function createStringHelper()
  53      {
  54          return new StringHelper();
  55      }
  56  }