Split InternalFactory into Manager and Helper factories

This commit is contained in:
Adrien Loison 2017-08-27 01:32:09 +02:00
parent d5e4a67d65
commit 35e718b84f
13 changed files with 247 additions and 171 deletions

View File

@ -5,6 +5,7 @@ namespace Box\Spout\Common\Creator;
use Box\Spout\Common\Helper\EncodingHelper;
use Box\Spout\Common\Helper\FileSystemHelper;
use Box\Spout\Common\Helper\GlobalFunctionsHelper;
use Box\Spout\Common\Helper\StringHelper;
/**
* Class HelperFactory
@ -39,4 +40,12 @@ class HelperFactory
{
return new EncodingHelper($globalFunctionsHelper);
}
/**
* @return StringHelper
*/
public function createStringHelper()
{
return new StringHelper();
}
}

View File

@ -6,6 +6,7 @@ use Box\Spout\Writer\Common\Entity\Cell;
use Box\Spout\Writer\Common\Entity\Sheet;
use Box\Spout\Writer\Common\Entity\Workbook;
use Box\Spout\Writer\Common\Entity\Worksheet;
use Box\Spout\Writer\Common\Manager\SheetManager;
/**
* Class EntityFactory
@ -15,19 +16,6 @@ use Box\Spout\Writer\Common\Entity\Worksheet;
*/
class EntityFactory
{
/** @var ManagerFactory */
private $managerFactory;
/**
* EntityFactory constructor.
*
* @param ManagerFactory $managerFactory
*/
public function __construct(ManagerFactory $managerFactory)
{
$this->managerFactory = $managerFactory;
}
/**
* @return Workbook
*/
@ -49,11 +37,11 @@ class EntityFactory
/**
* @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)
public function createSheet($sheetIndex, $associatedWorkbookId, $sheetManager)
{
$sheetManager = $this->managerFactory->createSheetManager();
return new Sheet($sheetIndex, $associatedWorkbookId, $sheetManager);
}

View File

@ -1,24 +0,0 @@
<?php
namespace Box\Spout\Writer\Common\Creator;
use Box\Spout\Common\Helper\StringHelper;
use Box\Spout\Writer\Common\Manager\SheetManager;
/**
* Class ManagerFactory
* Factory to create managers
*
* @package Box\Spout\Writer\Common\Creator
*/
class ManagerFactory
{
/**
* @return SheetManager
*/
public function createSheetManager()
{
$stringHelper = new StringHelper();
return new SheetManager($stringHelper);
}
}

View File

@ -3,18 +3,24 @@
namespace Box\Spout\Writer\Common\Creator;
use Box\Spout\Common\Manager\OptionsManagerInterface;
use Box\Spout\Writer\Common\Manager\SheetManager;
use Box\Spout\Writer\Common\Manager\WorkbookManagerInterface;
/**
* Interface InternalFactoryInterface
* Interface ManagerFactoryInterface
*
* @package Box\Spout\Writer\Common\Creator
*/
interface InternalFactoryInterface
interface ManagerFactoryInterface
{
/**
* @param OptionsManagerInterface $optionsManager
* @return WorkbookManagerInterface
*/
public function createWorkbookManager(OptionsManagerInterface $optionsManager);
/**
* @return SheetManager
*/
public function createSheetManager();
}

View File

@ -29,7 +29,7 @@ class Sheet
/**
* @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
* @param SheetManager $sheetManager To manage sheets
*/
public function __construct($sheetIndex, $associatedWorkbookId, SheetManager $sheetManager)
{

View File

@ -4,6 +4,7 @@ namespace Box\Spout\Writer\Common\Manager;
use Box\Spout\Common\Exception\IOException;
use Box\Spout\Common\Manager\OptionsManagerInterface;
use Box\Spout\Writer\Common\Creator\ManagerFactoryInterface;
use Box\Spout\Writer\Common\Helper\FileSystemWithRootFolderHelperInterface;
use Box\Spout\Writer\Common\Entity\Options;
use Box\Spout\Writer\Common\Manager\Style\StyleManagerInterface;
@ -41,6 +42,9 @@ abstract class WorkbookManagerAbstract implements WorkbookManagerInterface
/** @var EntityFactory Factory to create entities */
protected $entityFactory;
/** @var ManagerFactoryInterface $managerFactory Factory to create managers */
protected $managerFactory;
/** @var Worksheet The worksheet where data will be written to */
protected $currentWorksheet;
@ -52,6 +56,7 @@ abstract class WorkbookManagerAbstract implements WorkbookManagerInterface
* @param StyleManagerInterface $styleManager
* @param FileSystemWithRootFolderHelperInterface $fileSystemHelper
* @param EntityFactory $entityFactory
* @param ManagerFactoryInterface $managerFactory
*/
public function __construct(
Workbook $workbook,
@ -59,7 +64,8 @@ abstract class WorkbookManagerAbstract implements WorkbookManagerInterface
WorksheetManagerInterface $worksheetManager,
StyleManagerInterface $styleManager,
FileSystemWithRootFolderHelperInterface $fileSystemHelper,
EntityFactory $entityFactory)
EntityFactory $entityFactory,
ManagerFactoryInterface $managerFactory)
{
$this->workbook = $workbook;
$this->optionManager = $optionsManager;
@ -67,6 +73,7 @@ abstract class WorkbookManagerAbstract implements WorkbookManagerInterface
$this->styleManager = $styleManager;
$this->fileSystemHelper = $fileSystemHelper;
$this->entityFactory = $entityFactory;
$this->managerFactory = $managerFactory;
}
/**
@ -114,7 +121,8 @@ abstract class WorkbookManagerAbstract implements WorkbookManagerInterface
$worksheets = $this->getWorksheets();
$newSheetIndex = count($worksheets);
$sheet = $this->entityFactory->createSheet($newSheetIndex, $this->workbook->getInternalId());
$sheetManager = $this->managerFactory->createSheetManager();
$sheet = $this->entityFactory->createSheet($newSheetIndex, $this->workbook->getInternalId(), $sheetManager);
$worksheetFilePath = $this->getWorksheetFilePath($sheet);
$worksheet = $this->entityFactory->createWorksheet($worksheetFilePath, $sheet);

View File

@ -0,0 +1,58 @@
<?php
namespace Box\Spout\Writer\ODS\Creator;
use Box\Spout\Common\Helper\StringHelper;
use Box\Spout\Writer\Common\Helper\ZipHelper;
use Box\Spout\Common\Manager\OptionsManagerInterface;
use Box\Spout\Writer\Common\Entity\Options;
use Box\Spout\Writer\Common\Creator\EntityFactory;
use Box\Spout\Writer\ODS\Helper\FileSystemHelper;
use Box\Spout\Common\Helper\Escaper;
/**
* Class HelperFactory
* Factory for helpers needed by the ODS Writer
*
* @package Box\Spout\Writer\ODS\Creator
*/
class HelperFactory extends \Box\Spout\Common\Creator\HelperFactory
{
/**
* @param OptionsManagerInterface $optionsManager
* @param EntityFactory $entityFactory
* @return FileSystemHelper
*/
public function createSpecificFileSystemHelper(OptionsManagerInterface $optionsManager, EntityFactory $entityFactory)
{
$tempFolder = $optionsManager->getOption(Options::TEMP_FOLDER);
$zipHelper = $this->createZipHelper($entityFactory);
return new FileSystemHelper($tempFolder, $zipHelper);
}
/**
* @param $entityFactory
* @return ZipHelper
*/
private function createZipHelper($entityFactory)
{
return new ZipHelper($entityFactory);
}
/**
* @return Escaper\ODS
*/
public function createStringsEscaper()
{
return new Escaper\ODS();
}
/**
* @return StringHelper
*/
public function createStringHelper()
{
return new StringHelper();
}
}

View File

@ -2,38 +2,38 @@
namespace Box\Spout\Writer\ODS\Creator;
use Box\Spout\Common\Helper\StringHelper;
use Box\Spout\Writer\Common\Helper\ZipHelper;
use Box\Spout\Common\Manager\OptionsManagerInterface;
use Box\Spout\Writer\Common\Entity\Options;
use Box\Spout\Writer\Common\Creator\EntityFactory;
use Box\Spout\Writer\Common\Creator\InternalFactoryInterface;
use Box\Spout\Writer\ODS\Helper\FileSystemHelper;
use Box\Spout\Writer\Common\Entity\Options;
use Box\Spout\Writer\Common\Creator\ManagerFactoryInterface;
use Box\Spout\Writer\Common\Manager\SheetManager;
use Box\Spout\Writer\ODS\Manager\Style\StyleManager;
use Box\Spout\Writer\ODS\Manager\Style\StyleRegistry;
use Box\Spout\Writer\ODS\Manager\WorkbookManager;
use Box\Spout\Writer\ODS\Manager\WorksheetManager;
use Box\Spout\Common\Helper\Escaper;
/**
* Class InternalFactory
* Factory for all useful types of objects needed by the ODS Writer
* Class ManagerFactory
* Factory for managers needed by the ODS Writer
*
* @package Box\Spout\Writer\ODS\Creator
*/
class InternalFactory implements InternalFactoryInterface
class ManagerFactory implements ManagerFactoryInterface
{
/** @var EntityFactory */
private $entityFactory;
protected $entityFactory;
/** @var HelperFactory $helperFactory */
protected $helperFactory;
/**
* InternalFactory constructor.
*
* @param EntityFactory $entityFactory
* @param HelperFactory $helperFactory
*/
public function __construct(EntityFactory $entityFactory)
public function __construct(EntityFactory $entityFactory, HelperFactory $helperFactory)
{
$this->entityFactory = $entityFactory;
$this->helperFactory = $helperFactory;
}
/**
@ -44,13 +44,21 @@ class InternalFactory implements InternalFactoryInterface
{
$workbook = $this->entityFactory->createWorkbook();
$fileSystemHelper = $this->createFileSystemHelper($optionsManager);
$fileSystemHelper = $this->helperFactory->createSpecificFileSystemHelper($optionsManager, $this->entityFactory);
$fileSystemHelper->createBaseFilesAndFolders();
$styleManager = $this->createStyleManager($optionsManager);
$worksheetManager = $this->createWorksheetManager();
return new WorkbookManager($workbook, $optionsManager, $worksheetManager, $styleManager, $fileSystemHelper, $this->entityFactory);
return new WorkbookManager(
$workbook,
$optionsManager,
$worksheetManager,
$styleManager,
$fileSystemHelper,
$this->entityFactory,
$this
);
}
/**
@ -58,12 +66,21 @@ class InternalFactory implements InternalFactoryInterface
*/
private function createWorksheetManager()
{
$stringsEscaper = $this->createStringsEscaper();
$stringsHelper = $this->createStringHelper();
$stringsEscaper = $this->helperFactory->createStringsEscaper();
$stringsHelper = $this->helperFactory->createStringHelper();
return new WorksheetManager($stringsEscaper, $stringsHelper, $this->entityFactory);
}
/**
* @return SheetManager
*/
public function createSheetManager()
{
$stringHelper = $this->helperFactory->createStringHelper();
return new SheetManager($stringHelper);
}
/**
* @param OptionsManagerInterface $optionsManager
* @return StyleManager
@ -83,40 +100,4 @@ class InternalFactory implements InternalFactoryInterface
$defaultRowStyle = $optionsManager->getOption(Options::DEFAULT_ROW_STYLE);
return new StyleRegistry($defaultRowStyle);
}
/**
* @param OptionsManagerInterface $optionsManager
* @return FileSystemHelper
*/
public function createFileSystemHelper(OptionsManagerInterface $optionsManager)
{
$tempFolder = $optionsManager->getOption(Options::TEMP_FOLDER);
$zipHelper = $this->createZipHelper();
return new FileSystemHelper($tempFolder, $zipHelper);
}
/**
* @return ZipHelper
*/
private function createZipHelper()
{
return new ZipHelper($this->entityFactory);
}
/**
* @return Escaper\ODS
*/
private function createStringsEscaper()
{
return new Escaper\ODS();
}
/**
* @return StringHelper
*/
private function createStringHelper()
{
return new StringHelper();
}
}

View File

@ -2,10 +2,10 @@
namespace Box\Spout\Writer;
use Box\Spout\Common\Creator\HelperFactory;
use Box\Spout\Common\Exception\InvalidArgumentException;
use Box\Spout\Common\Exception\IOException;
use Box\Spout\Common\Exception\SpoutException;
use Box\Spout\Common\Helper\FileSystemHelper;
use Box\Spout\Common\Helper\GlobalFunctionsHelper;
use Box\Spout\Writer\Common\Entity\Options;
use Box\Spout\Writer\Common\Entity\Style\Style;
@ -34,6 +34,9 @@ abstract class WriterAbstract implements WriterInterface
/** @var GlobalFunctionsHelper Helper to work with global functions */
protected $globalFunctionsHelper;
/** @var HelperFactory $helperFactory */
protected $helperFactory;
/** @var OptionsManagerInterface Writer options manager */
protected $optionsManager;
@ -50,15 +53,18 @@ abstract class WriterAbstract implements WriterInterface
* @param OptionsManagerInterface $optionsManager
* @param StyleMerger $styleMerger
* @param GlobalFunctionsHelper $globalFunctionsHelper
* @param HelperFactory $helperFactory
*/
public function __construct(
OptionsManagerInterface $optionsManager,
StyleMerger $styleMerger,
GlobalFunctionsHelper $globalFunctionsHelper)
GlobalFunctionsHelper $globalFunctionsHelper,
HelperFactory $helperFactory)
{
$this->optionsManager = $optionsManager;
$this->styleMerger = $styleMerger;
$this->globalFunctionsHelper = $globalFunctionsHelper;
$this->helperFactory = $helperFactory;
$this->resetRowStyleToDefault();
}
@ -372,7 +378,7 @@ abstract class WriterAbstract implements WriterInterface
// remove output file if it was created
if ($this->globalFunctionsHelper->file_exists($this->outputFilePath)) {
$outputFolderPath = dirname($this->outputFilePath);
$fileSystemHelper = new FileSystemHelper($outputFolderPath);
$fileSystemHelper = $this->helperFactory->createFileSystemHelper($outputFolderPath);
$fileSystemHelper->deleteFile($this->outputFilePath);
}
}

View File

@ -2,11 +2,11 @@
namespace Box\Spout\Writer;
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\ManagerFactory;
use Box\Spout\Writer\Common\Creator\Style\StyleBuilder;
use Box\Spout\Writer\Common\Manager\Style\StyleMerger;
@ -47,7 +47,9 @@ class WriterFactory
$styleMerger = new StyleMerger();
$globalFunctionsHelper = new GlobalFunctionsHelper();
return new CSV\Writer($optionsManager, $styleMerger, $globalFunctionsHelper);
$helperFactory = new HelperFactory();
return new CSV\Writer($optionsManager, $styleMerger, $globalFunctionsHelper, $helperFactory);
}
/**
@ -60,10 +62,10 @@ class WriterFactory
$styleMerger = new StyleMerger();
$globalFunctionsHelper = new GlobalFunctionsHelper();
$entityFactory = new EntityFactory(new ManagerFactory());
$internalFactory = new XLSX\Creator\InternalFactory($entityFactory);
$helperFactory = new XLSX\Creator\HelperFactory();
$managerFactory = new XLSX\Creator\ManagerFactory(new EntityFactory(), $helperFactory);
return new XLSX\Writer($optionsManager, $styleMerger, $globalFunctionsHelper, $internalFactory);
return new XLSX\Writer($optionsManager, $styleMerger, $globalFunctionsHelper, $helperFactory, $managerFactory);
}
/**
@ -76,9 +78,9 @@ class WriterFactory
$styleMerger = new StyleMerger();
$globalFunctionsHelper = new GlobalFunctionsHelper();
$entityFactory = new EntityFactory(new ManagerFactory());
$internalFactory = new ODS\Creator\InternalFactory($entityFactory);
$helperFactory = new ODS\Creator\HelperFactory();
$managerFactory = new ODS\Creator\ManagerFactory(new EntityFactory(), $helperFactory);
return new ODS\Writer($optionsManager, $styleMerger, $globalFunctionsHelper, $internalFactory);
return new ODS\Writer($optionsManager, $styleMerger, $globalFunctionsHelper, $helperFactory, $managerFactory);
}
}

View File

@ -2,6 +2,7 @@
namespace Box\Spout\Writer;
use Box\Spout\Common\Creator\HelperFactory;
use Box\Spout\Common\Helper\GlobalFunctionsHelper;
use Box\Spout\Writer\Common\Entity\Sheet;
use Box\Spout\Common\Manager\OptionsManagerInterface;
@ -9,8 +10,9 @@ use Box\Spout\Writer\Common\Entity\Options;
use Box\Spout\Writer\Common\Entity\Worksheet;
use Box\Spout\Writer\Common\Manager\Style\StyleMerger;
use Box\Spout\Writer\Exception\SheetNotFoundException;
use Box\Spout\Writer\Exception\WriterAlreadyOpenedException;
use Box\Spout\Writer\Exception\WriterNotOpenedException;
use Box\Spout\Writer\Common\Creator\InternalFactoryInterface;
use Box\Spout\Writer\Common\Creator\ManagerFactoryInterface;
use Box\Spout\Writer\Common\Manager\WorkbookManagerInterface;
/**
@ -21,9 +23,8 @@ use Box\Spout\Writer\Common\Manager\WorkbookManagerInterface;
*/
abstract class WriterMultiSheetsAbstract extends WriterAbstract
{
/** @var InternalFactoryInterface */
private $internalFactory;
/** @var ManagerFactoryInterface */
private $managerFactory;
/** @var WorkbookManagerInterface */
private $workbookManager;
@ -32,16 +33,18 @@ abstract class WriterMultiSheetsAbstract extends WriterAbstract
* @param OptionsManagerInterface $optionsManager
* @param StyleMerger $styleMerger
* @param GlobalFunctionsHelper $globalFunctionsHelper
* @param InternalFactoryInterface $internalFactory
* @param HelperFactory $helperFactory
* @param ManagerFactoryInterface $managerFactory
*/
public function __construct(
OptionsManagerInterface $optionsManager,
StyleMerger $styleMerger,
GlobalFunctionsHelper $globalFunctionsHelper,
InternalFactoryInterface $internalFactory)
HelperFactory $helperFactory,
ManagerFactoryInterface $managerFactory)
{
parent::__construct($optionsManager, $styleMerger, $globalFunctionsHelper);
$this->internalFactory = $internalFactory;
parent::__construct($optionsManager, $styleMerger, $globalFunctionsHelper, $helperFactory);
$this->managerFactory = $managerFactory;
}
/**
@ -70,7 +73,7 @@ abstract class WriterMultiSheetsAbstract extends WriterAbstract
protected function openWriter()
{
if (!$this->workbookManager) {
$this->workbookManager = $this->internalFactory->createWorkbookManager($this->optionsManager);
$this->workbookManager = $this->managerFactory->createWorkbookManager($this->optionsManager);
$this->workbookManager->addNewSheetAndMakeItCurrent();
}
}

View File

@ -0,0 +1,59 @@
<?php
namespace Box\Spout\Writer\XLSX\Creator;
use Box\Spout\Common\Helper\Escaper;
use Box\Spout\Common\Helper\StringHelper;
use Box\Spout\Writer\Common\Creator\EntityFactory;
use Box\Spout\Writer\Common\Entity\Options;
use Box\Spout\Writer\Common\Helper\ZipHelper;
use Box\Spout\Common\Manager\OptionsManagerInterface;
use Box\Spout\Writer\XLSX\Helper\FileSystemHelper;
/**
* Class HelperFactory
* Factory for helpers needed by the XLSX Writer
*
* @package Box\Spout\Writer\XLSX\Creator
*/
class HelperFactory extends \Box\Spout\Common\Creator\HelperFactory
{
/**
* @param OptionsManagerInterface $optionsManager
* @param EntityFactory $entityFactory
* @return FileSystemHelper
*/
public function createSpecificFileSystemHelper(OptionsManagerInterface $optionsManager, EntityFactory $entityFactory)
{
$tempFolder = $optionsManager->getOption(Options::TEMP_FOLDER);
$zipHelper = $this->createZipHelper($entityFactory);
$escaper = $this->createStringsEscaper();
return new FileSystemHelper($tempFolder, $zipHelper, $escaper);
}
/**
* @param EntityFactory $entityFactory
* @return ZipHelper
*/
private function createZipHelper(EntityFactory $entityFactory)
{
return new ZipHelper($entityFactory);
}
/**
* @return Escaper\XLSX
*/
public function createStringsEscaper()
{
return new Escaper\XLSX();
}
/**
* @return StringHelper
*/
public function createStringHelper()
{
return new StringHelper();
}
}

View File

@ -2,14 +2,11 @@
namespace Box\Spout\Writer\XLSX\Creator;
use Box\Spout\Common\Helper\Escaper;
use Box\Spout\Common\Helper\StringHelper;
use Box\Spout\Writer\Common\Creator\EntityFactory;
use Box\Spout\Writer\Common\Creator\InternalFactoryInterface;
use Box\Spout\Writer\Common\Creator\ManagerFactoryInterface;
use Box\Spout\Writer\Common\Entity\Options;
use Box\Spout\Writer\Common\Helper\ZipHelper;
use Box\Spout\Common\Manager\OptionsManagerInterface;
use Box\Spout\Writer\XLSX\Helper\FileSystemHelper;
use Box\Spout\Writer\Common\Manager\SheetManager;
use Box\Spout\Writer\XLSX\Manager\SharedStringsManager;
use Box\Spout\Writer\XLSX\Manager\Style\StyleManager;
use Box\Spout\Writer\XLSX\Manager\Style\StyleRegistry;
@ -17,24 +14,27 @@ use Box\Spout\Writer\XLSX\Manager\WorkbookManager;
use Box\Spout\Writer\XLSX\Manager\WorksheetManager;
/**
* Class InternalFactory
* Factory for all useful types of objects needed by the XLSX Writer
* Class ManagerFactory
* Factory for managers needed by the XLSX Writer
*
* @package Box\Spout\Writer\XLSX\Creator
*/
class InternalFactory implements InternalFactoryInterface
class ManagerFactory implements ManagerFactoryInterface
{
/** @var EntityFactory */
private $entityFactory;
protected $entityFactory;
/** @var HelperFactory $helperFactory */
protected $helperFactory;
/**
* InternalFactory constructor.
*
* @param EntityFactory $entityFactory
* @param HelperFactory $helperFactory
*/
public function __construct(EntityFactory $entityFactory)
public function __construct(EntityFactory $entityFactory, HelperFactory $helperFactory)
{
$this->entityFactory = $entityFactory;
$this->helperFactory = $helperFactory;
}
/**
@ -45,7 +45,7 @@ class InternalFactory implements InternalFactoryInterface
{
$workbook = $this->entityFactory->createWorkbook();
$fileSystemHelper = $this->createFileSystemHelper($optionsManager);
$fileSystemHelper = $this->helperFactory->createSpecificFileSystemHelper($optionsManager, $this->entityFactory);
$fileSystemHelper->createBaseFilesAndFolders();
$xlFolder = $fileSystemHelper->getXlFolder();
@ -54,7 +54,15 @@ class InternalFactory implements InternalFactoryInterface
$styleManager = $this->createStyleManager($optionsManager);
$worksheetManager = $this->createWorksheetManager($optionsManager, $styleManager, $sharedStringsManager);
return new WorkbookManager($workbook, $optionsManager, $worksheetManager, $styleManager, $fileSystemHelper, $this->entityFactory);
return new WorkbookManager(
$workbook,
$optionsManager,
$worksheetManager,
$styleManager,
$fileSystemHelper,
$this->entityFactory,
$this
);
}
/**
@ -69,12 +77,21 @@ class InternalFactory implements InternalFactoryInterface
SharedStringsManager $sharedStringsManager
)
{
$stringsEscaper = $this->createStringsEscaper();
$stringsHelper = $this->createStringHelper();
$stringsEscaper = $this->helperFactory->createStringsEscaper();
$stringsHelper = $this->helperFactory->createStringHelper();
return new WorksheetManager($optionsManager, $styleManager, $sharedStringsManager, $stringsEscaper, $stringsHelper, $this->entityFactory);
}
/**
* @return SheetManager
*/
public function createSheetManager()
{
$stringHelper = $this->helperFactory->createStringHelper();
return new SheetManager($stringHelper);
}
/**
* @param OptionsManagerInterface $optionsManager
* @return StyleManager
@ -101,44 +118,7 @@ class InternalFactory implements InternalFactoryInterface
*/
private function createSharedStringsManager($xlFolder)
{
$stringEscaper = $this->createStringsEscaper();
$stringEscaper = $this->helperFactory->createStringsEscaper();
return new SharedStringsManager($xlFolder, $stringEscaper);
}
/**
* @param OptionsManagerInterface $optionsManager
* @return FileSystemHelper
*/
private function createFileSystemHelper(OptionsManagerInterface $optionsManager)
{
$tempFolder = $optionsManager->getOption(Options::TEMP_FOLDER);
$zipHelper = $this->createZipHelper();
$escaper = $this->createStringsEscaper();
return new FileSystemHelper($tempFolder, $zipHelper, $escaper);
}
/**
* @return ZipHelper
*/
private function createZipHelper()
{
return new ZipHelper($this->entityFactory);
}
/**
* @return Escaper\XLSX
*/
private function createStringsEscaper()
{
return new Escaper\XLSX();
}
/**
* @return StringHelper
*/
private function createStringHelper()
{
return new StringHelper();
}
}