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