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