Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 3.9.x will end* 10 May 2021 (12 months).
  • Bug fixes for security issues in 3.9.x will end* 8 May 2023 (36 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are 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  }