Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.
   1  <?php
   2  
   3  namespace Box\Spout\Reader\CSV\Manager;
   4  
   5  use Box\Spout\Common\Helper\EncodingHelper;
   6  use Box\Spout\Common\Manager\OptionsManagerAbstract;
   7  use Box\Spout\Reader\Common\Entity\Options;
   8  
   9  /**
  10   * Class OptionsManager
  11   * CSV Reader options manager
  12   */
  13  class OptionsManager extends OptionsManagerAbstract
  14  {
  15      /**
  16       * {@inheritdoc}
  17       */
  18      protected function getSupportedOptions()
  19      {
  20          return [
  21              Options::SHOULD_FORMAT_DATES,
  22              Options::SHOULD_PRESERVE_EMPTY_ROWS,
  23              Options::FIELD_DELIMITER,
  24              Options::FIELD_ENCLOSURE,
  25              Options::ENCODING,
  26          ];
  27      }
  28  
  29      /**
  30       * {@inheritdoc}
  31       */
  32      protected function setDefaultOptions()
  33      {
  34          $this->setOption(Options::SHOULD_FORMAT_DATES, false);
  35          $this->setOption(Options::SHOULD_PRESERVE_EMPTY_ROWS, false);
  36          $this->setOption(Options::FIELD_DELIMITER, ',');
  37          $this->setOption(Options::FIELD_ENCLOSURE, '"');
  38          $this->setOption(Options::ENCODING, EncodingHelper::ENCODING_UTF8);
  39      }
  40  }