diff --git a/src/Spout/Writer/Common/Creator/EntityFactory.php b/src/Spout/Writer/Common/Creator/EntityFactory.php index 91d7576..c683251 100644 --- a/src/Spout/Writer/Common/Creator/EntityFactory.php +++ b/src/Spout/Writer/Common/Creator/EntityFactory.php @@ -4,49 +4,16 @@ namespace Box\Spout\Writer\Common\Creator; use Box\Spout\Writer\Common\Entity\Cell; use Box\Spout\Writer\Common\Entity\Row; -use Box\Spout\Writer\Common\Entity\Sheet; use Box\Spout\Writer\Common\Entity\Style\Style; -use Box\Spout\Writer\Common\Entity\Workbook; -use Box\Spout\Writer\Common\Entity\Worksheet; use Box\Spout\Writer\Common\Manager\RowManager; -use Box\Spout\Writer\Common\Manager\SheetManager; use Box\Spout\Writer\Common\Manager\Style\StyleMerger; /** * Class EntityFactory - * Factory to create entities + * Factory to create external entities */ class EntityFactory { - /** - * @return Workbook - */ - public function createWorkbook() - { - return new Workbook(); - } - - /** - * @param string $worksheetFilePath - * @param Sheet $externalSheet - * @return Worksheet - */ - public function createWorksheet($worksheetFilePath, Sheet $externalSheet) - { - return new Worksheet($worksheetFilePath, $externalSheet); - } - - /** - * @param int $sheetIndex Index of the sheet, based on order in the workbook (zero-based) - * @param string $associatedWorkbookId ID of the sheet's associated workbook - * @param SheetManager $sheetManager To manage sheets - * @return Sheet - */ - public function createSheet($sheetIndex, $associatedWorkbookId, $sheetManager) - { - return new Sheet($sheetIndex, $associatedWorkbookId, $sheetManager); - } - /** * @param mixed $cellValue * @param Style|null $cellStyle @@ -57,14 +24,6 @@ class EntityFactory return new Cell($cellValue, $cellStyle); } - /** - * @return \ZipArchive - */ - public function createZipArchive() - { - return new \ZipArchive(); - } - /** * @param array $cells * @param Style|null $rowStyle diff --git a/src/Spout/Writer/Common/Creator/InternalEntityFactory.php b/src/Spout/Writer/Common/Creator/InternalEntityFactory.php new file mode 100644 index 0000000..5e8a1d4 --- /dev/null +++ b/src/Spout/Writer/Common/Creator/InternalEntityFactory.php @@ -0,0 +1,52 @@ +workbook = $workbook; diff --git a/src/Spout/Writer/ODS/Creator/HelperFactory.php b/src/Spout/Writer/ODS/Creator/HelperFactory.php index bcb64b5..e6aa645 100644 --- a/src/Spout/Writer/ODS/Creator/HelperFactory.php +++ b/src/Spout/Writer/ODS/Creator/HelperFactory.php @@ -5,7 +5,7 @@ namespace Box\Spout\Writer\ODS\Creator; use Box\Spout\Common\Helper\Escaper; use Box\Spout\Common\Helper\StringHelper; use Box\Spout\Common\Manager\OptionsManagerInterface; -use Box\Spout\Writer\Common\Creator\EntityFactory; +use Box\Spout\Writer\Common\Creator\InternalEntityFactory; use Box\Spout\Writer\Common\Entity\Options; use Box\Spout\Writer\Common\Helper\ZipHelper; use Box\Spout\Writer\ODS\Helper\FileSystemHelper; @@ -18,10 +18,10 @@ class HelperFactory extends \Box\Spout\Common\Creator\HelperFactory { /** * @param OptionsManagerInterface $optionsManager - * @param EntityFactory $entityFactory + * @param InternalEntityFactory $entityFactory * @return FileSystemHelper */ - public function createSpecificFileSystemHelper(OptionsManagerInterface $optionsManager, EntityFactory $entityFactory) + public function createSpecificFileSystemHelper(OptionsManagerInterface $optionsManager, InternalEntityFactory $entityFactory) { $tempFolder = $optionsManager->getOption(Options::TEMP_FOLDER); $zipHelper = $this->createZipHelper($entityFactory); diff --git a/src/Spout/Writer/ODS/Creator/ManagerFactory.php b/src/Spout/Writer/ODS/Creator/ManagerFactory.php index 7624c4c..c8072c9 100644 --- a/src/Spout/Writer/ODS/Creator/ManagerFactory.php +++ b/src/Spout/Writer/ODS/Creator/ManagerFactory.php @@ -3,7 +3,7 @@ namespace Box\Spout\Writer\ODS\Creator; use Box\Spout\Common\Manager\OptionsManagerInterface; -use Box\Spout\Writer\Common\Creator\EntityFactory; +use Box\Spout\Writer\Common\Creator\InternalEntityFactory; use Box\Spout\Writer\Common\Creator\ManagerFactoryInterface; use Box\Spout\Writer\Common\Entity\Options; use Box\Spout\Writer\Common\Manager\SheetManager; @@ -18,17 +18,17 @@ use Box\Spout\Writer\ODS\Manager\WorksheetManager; */ class ManagerFactory implements ManagerFactoryInterface { - /** @var EntityFactory */ + /** @var InternalEntityFactory */ protected $entityFactory; /** @var HelperFactory $helperFactory */ protected $helperFactory; /** - * @param EntityFactory $entityFactory + * @param InternalEntityFactory $entityFactory * @param HelperFactory $helperFactory */ - public function __construct(EntityFactory $entityFactory, HelperFactory $helperFactory) + public function __construct(InternalEntityFactory $entityFactory, HelperFactory $helperFactory) { $this->entityFactory = $entityFactory; $this->helperFactory = $helperFactory; diff --git a/src/Spout/Writer/WriterFactory.php b/src/Spout/Writer/WriterFactory.php index 6e7d8de..e3df0fd 100644 --- a/src/Spout/Writer/WriterFactory.php +++ b/src/Spout/Writer/WriterFactory.php @@ -6,7 +6,7 @@ use Box\Spout\Common\Creator\HelperFactory; use Box\Spout\Common\Exception\UnsupportedTypeException; use Box\Spout\Common\Helper\GlobalFunctionsHelper; use Box\Spout\Common\Type; -use Box\Spout\Writer\Common\Creator\EntityFactory; +use Box\Spout\Writer\Common\Creator\InternalEntityFactory; use Box\Spout\Writer\Common\Creator\Style\StyleBuilder; use Box\Spout\Writer\Common\Manager\Style\StyleMerger; @@ -60,7 +60,7 @@ class WriterFactory $globalFunctionsHelper = new GlobalFunctionsHelper(); $helperFactory = new XLSX\Creator\HelperFactory(); - $managerFactory = new XLSX\Creator\ManagerFactory(new EntityFactory(), $helperFactory); + $managerFactory = new XLSX\Creator\ManagerFactory(new InternalEntityFactory(), $helperFactory); return new XLSX\Writer($optionsManager, $styleMerger, $globalFunctionsHelper, $helperFactory, $managerFactory); } @@ -76,7 +76,7 @@ class WriterFactory $globalFunctionsHelper = new GlobalFunctionsHelper(); $helperFactory = new ODS\Creator\HelperFactory(); - $managerFactory = new ODS\Creator\ManagerFactory(new EntityFactory(), $helperFactory); + $managerFactory = new ODS\Creator\ManagerFactory(new InternalEntityFactory(), $helperFactory); return new ODS\Writer($optionsManager, $styleMerger, $globalFunctionsHelper, $helperFactory, $managerFactory); } diff --git a/src/Spout/Writer/XLSX/Creator/HelperFactory.php b/src/Spout/Writer/XLSX/Creator/HelperFactory.php index 8eea878..e295170 100644 --- a/src/Spout/Writer/XLSX/Creator/HelperFactory.php +++ b/src/Spout/Writer/XLSX/Creator/HelperFactory.php @@ -5,7 +5,7 @@ namespace Box\Spout\Writer\XLSX\Creator; use Box\Spout\Common\Helper\Escaper; use Box\Spout\Common\Helper\StringHelper; use Box\Spout\Common\Manager\OptionsManagerInterface; -use Box\Spout\Writer\Common\Creator\EntityFactory; +use Box\Spout\Writer\Common\Creator\InternalEntityFactory; use Box\Spout\Writer\Common\Entity\Options; use Box\Spout\Writer\Common\Helper\ZipHelper; use Box\Spout\Writer\XLSX\Helper\FileSystemHelper; @@ -18,10 +18,10 @@ class HelperFactory extends \Box\Spout\Common\Creator\HelperFactory { /** * @param OptionsManagerInterface $optionsManager - * @param EntityFactory $entityFactory + * @param InternalEntityFactory $entityFactory * @return FileSystemHelper */ - public function createSpecificFileSystemHelper(OptionsManagerInterface $optionsManager, EntityFactory $entityFactory) + public function createSpecificFileSystemHelper(OptionsManagerInterface $optionsManager, InternalEntityFactory $entityFactory) { $tempFolder = $optionsManager->getOption(Options::TEMP_FOLDER); $zipHelper = $this->createZipHelper($entityFactory); @@ -31,10 +31,10 @@ class HelperFactory extends \Box\Spout\Common\Creator\HelperFactory } /** - * @param EntityFactory $entityFactory + * @param InternalEntityFactory $entityFactory * @return ZipHelper */ - private function createZipHelper(EntityFactory $entityFactory) + private function createZipHelper(InternalEntityFactory $entityFactory) { return new ZipHelper($entityFactory); } diff --git a/src/Spout/Writer/XLSX/Creator/ManagerFactory.php b/src/Spout/Writer/XLSX/Creator/ManagerFactory.php index b8d1f07..09bb70b 100644 --- a/src/Spout/Writer/XLSX/Creator/ManagerFactory.php +++ b/src/Spout/Writer/XLSX/Creator/ManagerFactory.php @@ -3,7 +3,7 @@ namespace Box\Spout\Writer\XLSX\Creator; use Box\Spout\Common\Manager\OptionsManagerInterface; -use Box\Spout\Writer\Common\Creator\EntityFactory; +use Box\Spout\Writer\Common\Creator\InternalEntityFactory; use Box\Spout\Writer\Common\Creator\ManagerFactoryInterface; use Box\Spout\Writer\Common\Entity\Options; use Box\Spout\Writer\Common\Manager\SheetManager; @@ -19,17 +19,17 @@ use Box\Spout\Writer\XLSX\Manager\WorksheetManager; */ class ManagerFactory implements ManagerFactoryInterface { - /** @var EntityFactory */ + /** @var InternalEntityFactory */ protected $entityFactory; /** @var HelperFactory $helperFactory */ protected $helperFactory; /** - * @param EntityFactory $entityFactory + * @param InternalEntityFactory $entityFactory * @param HelperFactory $helperFactory */ - public function __construct(EntityFactory $entityFactory, HelperFactory $helperFactory) + public function __construct(InternalEntityFactory $entityFactory, HelperFactory $helperFactory) { $this->entityFactory = $entityFactory; $this->helperFactory = $helperFactory; diff --git a/src/Spout/Writer/XLSX/Manager/WorksheetManager.php b/src/Spout/Writer/XLSX/Manager/WorksheetManager.php index 3701b93..613eabd 100644 --- a/src/Spout/Writer/XLSX/Manager/WorksheetManager.php +++ b/src/Spout/Writer/XLSX/Manager/WorksheetManager.php @@ -7,7 +7,7 @@ use Box\Spout\Common\Exception\IOException; use Box\Spout\Common\Helper\Escaper\XLSX as XLSXEscaper; use Box\Spout\Common\Helper\StringHelper; use Box\Spout\Common\Manager\OptionsManagerInterface; -use Box\Spout\Writer\Common\Creator\EntityFactory; +use Box\Spout\Writer\Common\Creator\InternalEntityFactory; use Box\Spout\Writer\Common\Entity\Cell; use Box\Spout\Writer\Common\Entity\Options; use Box\Spout\Writer\Common\Entity\Row; @@ -51,7 +51,7 @@ EOD; /** @var StringHelper String helper */ private $stringHelper; - /** @var EntityFactory Factory to create entities */ + /** @var InternalEntityFactory Factory to create entities */ private $entityFactory; /** @@ -62,7 +62,7 @@ EOD; * @param SharedStringsManager $sharedStringsManager * @param XLSXEscaper $stringsEscaper * @param StringHelper $stringHelper - * @param EntityFactory $entityFactory + * @param InternalEntityFactory $entityFactory */ public function __construct( OptionsManagerInterface $optionsManager, @@ -70,7 +70,7 @@ EOD; SharedStringsManager $sharedStringsManager, XLSXEscaper $stringsEscaper, StringHelper $stringHelper, - EntityFactory $entityFactory + InternalEntityFactory $entityFactory ) { $this->shouldUseInlineStrings = $optionsManager->getOption(Options::SHOULD_USE_INLINE_STRINGS); $this->styleManager = $styleManager;