Introduce an options manager for all writers (#423)

This will improve the management of options and simplify some methods' signatures.
This commit will also help moving the code to a better state regarding Dependency Injection.
This commit is contained in:
Adrien Loison authored and GitHub committed 2017-05-24 13:17:50 +02:00
1 parent f9d8ad8be3
commit a366d0d0af
22 files changed
+447 -113

No files matched your search

@@ -0,0 +1,36 @@
<?php
namespace Box\Spout\Writer\CSV\Manager;
use Box\Spout\Writer\Common\Options;
/**
* Class OptionsManager
* CSV Writer options manager
*
* @package Box\Spout\Writer\CSV\Manager
*/
class OptionsManager extends \Box\Spout\Writer\Common\Manager\OptionsManager
{
/**
* @inheritdoc
*/
protected function getSupportedOptions()
{
return [
Options::FIELD_DELIMITER,
Options::FIELD_ENCLOSURE,
Options::SHOULD_ADD_BOM,
];
}
/**
* @inheritdoc
*/
protected function setDefaultOptions()
{
$this->setOption(Options::FIELD_DELIMITER, ',');
$this->setOption(Options::FIELD_ENCLOSURE, '"');
$this->setOption(Options::SHOULD_ADD_BOM, true);
}
}