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\Reader\ODS\Creator;
   4  
   5  use Box\Spout\Reader\ODS\Helper\CellValueFormatter;
   6  use Box\Spout\Reader\ODS\Helper\SettingsHelper;
   7  
   8  /**
   9   * Class HelperFactory
  10   * Factory to create helpers
  11   */
  12  class HelperFactory extends \Box\Spout\Common\Creator\HelperFactory
  13  {
  14      /**
  15       * @param bool $shouldFormatDates Whether date/time values should be returned as PHP objects or be formatted as strings
  16       * @return CellValueFormatter
  17       */
  18      public function createCellValueFormatter($shouldFormatDates)
  19      {
  20          $escaper = $this->createStringsEscaper();
  21  
  22          return new CellValueFormatter($shouldFormatDates, $escaper);
  23      }
  24  
  25      /**
  26       * @param InternalEntityFactory $entityFactory
  27       * @return SettingsHelper
  28       */
  29      public function createSettingsHelper($entityFactory)
  30      {
  31          return new SettingsHelper($entityFactory);
  32      }
  33  
  34      /**
  35       * @return \Box\Spout\Common\Helper\Escaper\ODS
  36       */
  37      public function createStringsEscaper()
  38      {
  39          /* @noinspection PhpUnnecessaryFullyQualifiedNameInspection */
  40          return new \Box\Spout\Common\Helper\Escaper\ODS();
  41      }
  42  }