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\XLSX\Creator;
   4  
   5  use Box\Spout\Common\Helper\Escaper;
   6  use Box\Spout\Reader\XLSX\Helper\CellValueFormatter;
   7  use Box\Spout\Reader\XLSX\Manager\SharedStringsManager;
   8  use Box\Spout\Reader\XLSX\Manager\StyleManager;
   9  
  10  /**
  11   * Class HelperFactory
  12   * Factory to create helpers
  13   */
  14  class HelperFactory extends \Box\Spout\Common\Creator\HelperFactory
  15  {
  16      /**
  17       * @param SharedStringsManager $sharedStringsManager Manages shared strings
  18       * @param StyleManager $styleManager Manages styles
  19       * @param bool $shouldFormatDates Whether date/time values should be returned as PHP objects or be formatted as strings
  20       * @param bool $shouldUse1904Dates Whether date/time values should use a calendar starting in 1904 instead of 1900
  21       * @return CellValueFormatter
  22       */
  23      public function createCellValueFormatter($sharedStringsManager, $styleManager, $shouldFormatDates, $shouldUse1904Dates)
  24      {
  25          $escaper = $this->createStringsEscaper();
  26  
  27          return new CellValueFormatter($sharedStringsManager, $styleManager, $shouldFormatDates, $shouldUse1904Dates, $escaper);
  28      }
  29  
  30      /**
  31       * @return Escaper\XLSX
  32       */
  33      public function createStringsEscaper()
  34      {
  35          /* @noinspection PhpUnnecessaryFullyQualifiedNameInspection */
  36          return new Escaper\XLSX();
  37      }
  38  }