Refactor readers for better di (#457)

* Refactor readers to get a proper DI

Similar to what was done with writers, readers also needed to be updated to match the new way of doing things.
This commits promotes a better DI (factories, injection through constructors).

* Escapers should not be singletons

Instead, they should be proper object that can be injected where needed.
This commit is contained in:
Adrien Loison authored and GitHub committed 2017-08-27 00:01:17 +02:00
1 parent 4d6437fa77
commit b7e46740ce
66 files changed
+1095 -618

No files matched your search

+5 -3
View File
@@ -2,6 +2,7 @@
namespace Box\Spout\Reader\ODS;
use Box\Spout\Reader\ODS\Creator\EntityFactory;
use Box\Spout\Reader\SheetInterface;
use Box\Spout\Reader\Wrapper\XMLReader;
@@ -33,11 +34,12 @@ class Sheet implements SheetInterface
* @param int $sheetIndex Index of the sheet, based on order in the workbook (zero-based)
* @param string $sheetName Name of the sheet
* @param bool $isSheetActive Whether the sheet was defined as active
* @param \Box\Spout\Reader\ODS\ReaderOptions $options Reader's current options
* @param \Box\Spout\Common\Manager\OptionsManagerInterface $optionsManager Reader's options manager
* @param EntityFactory $entityFactory Factory to create entities
*/
public function __construct($xmlReader, $sheetIndex, $sheetName, $isSheetActive, $options)
public function __construct($xmlReader, $sheetIndex, $sheetName, $isSheetActive, $optionsManager, $entityFactory)
{
$this->rowIterator = new RowIterator($xmlReader, $options);
$this->rowIterator = $entityFactory->createRowIterator($xmlReader, $optionsManager);
$this->index = $sheetIndex;
$this->name = $sheetName;
$this->isActive = $isSheetActive;