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