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\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  }