Make CSV reader return Row objects

This commit is contained in:
Adrien Loison committed 2017-11-18 19:08:27 +01:00
1 parent 139f7fdfb3
commit a665b974fa
37 files changed
+664 -214

No files matched your search

@@ -2,7 +2,7 @@
namespace Box\Spout\Reader\XLSX\Creator;
use Box\Spout\Reader\Common\Creator\EntityFactoryInterface;
use Box\Spout\Reader\Common\Creator\InternalEntityFactoryInterface;
use Box\Spout\Reader\Common\Entity\Options;
use Box\Spout\Reader\Common\XMLProcessor;
use Box\Spout\Reader\Wrapper\XMLReader;
@@ -10,13 +10,12 @@ use Box\Spout\Reader\XLSX\Manager\SharedStringsManager;
use Box\Spout\Reader\XLSX\RowIterator;
use Box\Spout\Reader\XLSX\Sheet;
use Box\Spout\Reader\XLSX\SheetIterator;
use MongoDB\Driver\Manager;
/**
* Class EntityFactory
* Factory to create entities
*/
class EntityFactory implements EntityFactoryInterface
class InternalEntityFactory implements InternalEntityFactoryInterface
{
/** @var HelperFactory */
private $helperFactory;
@@ -36,7 +36,7 @@ class ManagerFactory
/**
* @param string $filePath Path of the XLSX file being read
* @param string $tempFolder Temporary folder where the temporary files to store shared strings will be stored
* @param EntityFactory $entityFactory Factory to create entities
* @param InternalEntityFactory $entityFactory Factory to create entities
* @return SharedStringsManager
*/
public function createSharedStringsManager($filePath, $tempFolder, $entityFactory)
@@ -55,7 +55,7 @@ class ManagerFactory
/**
* @param string $filePath Path of the XLSX file being read
* @param EntityFactory $entityFactory Factory to create entities
* @param InternalEntityFactory $entityFactory Factory to create entities
* @return WorkbookRelationshipsManager
*/
private function createWorkbookRelationshipsManager($filePath, $entityFactory)
@@ -71,7 +71,7 @@ class ManagerFactory
* @param string $filePath Path of the XLSX file being read
* @param \Box\Spout\Common\Manager\OptionsManagerInterface $optionsManager Reader's options manager
* @param \Box\Spout\Reader\XLSX\Manager\SharedStringsManager $sharedStringsManager Manages shared strings
* @param EntityFactory $entityFactory Factory to create entities
* @param InternalEntityFactory $entityFactory Factory to create entities
* @return SheetManager
*/
public function createSheetManager($filePath, $optionsManager, $sharedStringsManager, $entityFactory)
@@ -83,7 +83,7 @@ class ManagerFactory
/**
* @param string $filePath Path of the XLSX file being read
* @param EntityFactory $entityFactory Factory to create entities
* @param InternalEntityFactory $entityFactory Factory to create entities
* @return StyleManager
*/
public function createStyleManager($filePath, $entityFactory)
@@ -5,8 +5,8 @@ namespace Box\Spout\Reader\XLSX\Manager;
use Box\Spout\Common\Exception\IOException;
use Box\Spout\Reader\Exception\XMLProcessingException;
use Box\Spout\Reader\Wrapper\XMLReader;
use Box\Spout\Reader\XLSX\Creator\EntityFactory;
use Box\Spout\Reader\XLSX\Creator\HelperFactory;
use Box\Spout\Reader\XLSX\Creator\InternalEntityFactory;
use Box\Spout\Reader\XLSX\Manager\SharedStringsCaching\CachingStrategyFactory;
use Box\Spout\Reader\XLSX\Manager\SharedStringsCaching\CachingStrategyInterface;
use Box\Spout\Writer\Common\Entity\Workbook;
@@ -41,7 +41,7 @@ class SharedStringsManager
/** @var WorkbookRelationshipsManager Helps retrieving workbook relationships */
protected $workbookRelationshipsManager;
/** @var EntityFactory Factory to create entities */
/** @var InternalEntityFactory Factory to create entities */
protected $entityFactory;
/** @var HelperFactory $helperFactory Factory to create helpers */
@@ -57,7 +57,7 @@ class SharedStringsManager
* @param string $filePath Path of the XLSX file being read
* @param string $tempFolder Temporary folder where the temporary files to store shared strings will be stored
* @param WorkbookRelationshipsManager $workbookRelationshipsManager Helps retrieving workbook relationships
* @param EntityFactory $entityFactory Factory to create entities
* @param InternalEntityFactory $entityFactory Factory to create entities
* @param HelperFactory $helperFactory Factory to create helpers
* @param CachingStrategyFactory $cachingStrategyFactory Factory to create shared strings caching strategies
*/
@@ -4,7 +4,7 @@ namespace Box\Spout\Reader\XLSX\Manager;
use Box\Spout\Reader\Common\Entity\Options;
use Box\Spout\Reader\Common\XMLProcessor;
use Box\Spout\Reader\XLSX\Creator\EntityFactory;
use Box\Spout\Reader\XLSX\Creator\InternalEntityFactory;
use Box\Spout\Reader\XLSX\Sheet;
/**
@@ -48,7 +48,7 @@ class SheetManager
/** @var \Box\Spout\Common\Helper\GlobalFunctionsHelper Helper to work with global functions */
protected $globalFunctionsHelper;
/** @var EntityFactory Factory to create entities */
/** @var InternalEntityFactory Factory to create entities */
protected $entityFactory;
/** @var \Box\Spout\Common\Helper\Escaper\XLSX Used to unescape XML data */
@@ -68,7 +68,7 @@ class SheetManager
* @param \Box\Spout\Common\Manager\OptionsManagerInterface $optionsManager Reader's options manager
* @param \Box\Spout\Reader\XLSX\Manager\SharedStringsManager $sharedStringsManager Manages shared strings
* @param \Box\Spout\Common\Helper\Escaper\XLSX $escaper Used to unescape XML data
* @param EntityFactory $entityFactory Factory to create entities
* @param InternalEntityFactory $entityFactory Factory to create entities
* @param mixed $sharedStringsManager
*/
public function __construct($filePath, $optionsManager, $sharedStringsManager, $escaper, $entityFactory)
@@ -2,7 +2,7 @@
namespace Box\Spout\Reader\XLSX\Manager;
use Box\Spout\Reader\XLSX\Creator\EntityFactory;
use Box\Spout\Reader\XLSX\Creator\InternalEntityFactory;
/**
* Class StyleManager
@@ -51,7 +51,7 @@ class StyleManager
/** @var string Path of the styles XML file */
protected $stylesXMLFilePath;
/** @var EntityFactory Factory to create entities */
/** @var InternalEntityFactory Factory to create entities */
protected $entityFactory;
/** @var array Array containing the IDs of built-in number formats indicating a date */
@@ -69,7 +69,7 @@ class StyleManager
/**
* @param string $filePath Path of the XLSX file being read
* @param WorkbookRelationshipsManager $workbookRelationshipsManager Helps retrieving workbook relationships
* @param EntityFactory $entityFactory Factory to create entities
* @param InternalEntityFactory $entityFactory Factory to create entities
*/
public function __construct($filePath, $workbookRelationshipsManager, $entityFactory)
{
@@ -4,7 +4,7 @@ namespace Box\Spout\Reader\XLSX\Manager;
use Box\Spout\Common\Exception\IOException;
use Box\Spout\Reader\Wrapper\XMLReader;
use Box\Spout\Reader\XLSX\Creator\EntityFactory;
use Box\Spout\Reader\XLSX\Creator\InternalEntityFactory;
/**
* Class WorkbookRelationshipsManager
@@ -30,7 +30,7 @@ class WorkbookRelationshipsManager
/** @var string Path of the XLSX file being read */
private $filePath;
/** @var EntityFactory Factory to create entities */
/** @var InternalEntityFactory Factory to create entities */
private $entityFactory;
/** @var array Cache of the already read workbook relationships: [TYPE] => [FILE_NAME] */
@@ -38,7 +38,7 @@ class WorkbookRelationshipsManager
/**
* @param string $filePath Path of the XLSX file being read
* @param EntityFactory $entityFactory Factory to create entities
* @param InternalEntityFactory $entityFactory Factory to create entities
*/
public function __construct($filePath, $entityFactory)
{
+5 -5
View File
@@ -5,10 +5,10 @@ namespace Box\Spout\Reader\XLSX;
use Box\Spout\Common\Exception\IOException;
use Box\Spout\Common\Helper\GlobalFunctionsHelper;
use Box\Spout\Common\Manager\OptionsManagerInterface;
use Box\Spout\Reader\Common\Creator\EntityFactoryInterface;
use Box\Spout\Reader\Common\Creator\InternalEntityFactoryInterface;
use Box\Spout\Reader\Common\Entity\Options;
use Box\Spout\Reader\ReaderAbstract;
use Box\Spout\Reader\XLSX\Creator\EntityFactory;
use Box\Spout\Reader\XLSX\Creator\InternalEntityFactory;
use Box\Spout\Reader\XLSX\Creator\ManagerFactory;
/**
@@ -32,13 +32,13 @@ class Reader extends ReaderAbstract
/**
* @param OptionsManagerInterface $optionsManager
* @param GlobalFunctionsHelper $globalFunctionsHelper
* @param EntityFactoryInterface $entityFactory
* @param InternalEntityFactoryInterface $entityFactory
* @param ManagerFactory $managerFactory
*/
public function __construct(
OptionsManagerInterface $optionsManager,
GlobalFunctionsHelper $globalFunctionsHelper,
EntityFactoryInterface $entityFactory,
InternalEntityFactoryInterface $entityFactory,
ManagerFactory $managerFactory
) {
parent::__construct($optionsManager, $globalFunctionsHelper, $entityFactory);
@@ -78,7 +78,7 @@ class Reader extends ReaderAbstract
*/
protected function openReader($filePath)
{
/** @var EntityFactory $entityFactory */
/** @var InternalEntityFactory $entityFactory */
$entityFactory = $this->entityFactory;
$this->zip = $entityFactory->createZipArchive();