| 1 |
<?php |
| 2 |
|
| 3 |
namespace FluentCart\OpenSpout\Writer\XLSX\Manager; |
| 4 |
|
| 5 |
use FluentCart\OpenSpout\Common\Manager\OptionsManagerAbstract; |
| 6 |
use FluentCart\OpenSpout\Writer\Common\Creator\Style\StyleBuilder; |
| 7 |
use FluentCart\OpenSpout\Writer\Common\Entity\Options; |
| 8 |
/** |
| 9 |
* XLSX Writer options manager. |
| 10 |
*/ |
| 11 |
class OptionsManager extends OptionsManagerAbstract |
| 12 |
{ |
| 13 |
/** Default style font values */ |
| 14 |
public const DEFAULT_FONT_SIZE = 12; |
| 15 |
public const DEFAULT_FONT_NAME = 'Calibri'; |
| 16 |
/** @var StyleBuilder Style builder */ |
| 17 |
protected $styleBuilder; |
| 18 |
/** |
| 19 |
* OptionsManager constructor. |
| 20 |
*/ |
| 21 |
public function __construct(StyleBuilder $styleBuilder) |
| 22 |
{ |
| 23 |
$this->styleBuilder = $styleBuilder; |
| 24 |
parent::__construct(); |
| 25 |
} |
| 26 |
/** |
| 27 |
* {@inheritdoc} |
| 28 |
*/ |
| 29 |
protected function getSupportedOptions() |
| 30 |
{ |
| 31 |
return [Options::TEMP_FOLDER, Options::DEFAULT_ROW_STYLE, Options::SHOULD_CREATE_NEW_SHEETS_AUTOMATICALLY, Options::SHOULD_USE_INLINE_STRINGS, Options::DEFAULT_COLUMN_WIDTH, Options::DEFAULT_ROW_HEIGHT, Options::COLUMN_WIDTHS, Options::MERGE_CELLS]; |
| 32 |
} |
| 33 |
/** |
| 34 |
* {@inheritdoc} |
| 35 |
*/ |
| 36 |
protected function setDefaultOptions() |
| 37 |
{ |
| 38 |
$defaultRowStyle = $this->styleBuilder->setFontSize(self::DEFAULT_FONT_SIZE)->setFontName(self::DEFAULT_FONT_NAME)->build(); |
| 39 |
$this->setOption(Options::TEMP_FOLDER, \sys_get_temp_dir()); |
| 40 |
$this->setOption(Options::DEFAULT_ROW_STYLE, $defaultRowStyle); |
| 41 |
$this->setOption(Options::SHOULD_CREATE_NEW_SHEETS_AUTOMATICALLY, \true); |
| 42 |
$this->setOption(Options::SHOULD_USE_INLINE_STRINGS, \true); |
| 43 |
$this->setOption(Options::MERGE_CELLS, []); |
| 44 |
} |
| 45 |
} |
| 46 |
|