1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Box\Spout\Reader\ODS\Creator; |
4
|
|
|
|
5
|
|
|
use Box\Spout\Common\Helper\GlobalFunctionsHelper; |
6
|
|
|
use Box\Spout\Common\Manager\OptionsManagerInterface; |
7
|
|
|
use Box\Spout\Reader\Common\Creator\EntityFactoryInterface; |
8
|
|
|
use Box\Spout\Reader\Common\XMLProcessor; |
9
|
|
|
use Box\Spout\Reader\ODS\RowIterator; |
10
|
|
|
use Box\Spout\Reader\ODS\Sheet; |
11
|
|
|
use Box\Spout\Reader\ODS\SheetIterator; |
12
|
|
|
use Box\Spout\Reader\Wrapper\XMLReader; |
13
|
|
|
|
14
|
|
|
/** |
15
|
|
|
* Class EntityFactory |
16
|
|
|
* Factory to create entities |
17
|
|
|
* |
18
|
|
|
* @package Box\Spout\Reader\ODS\Creator |
19
|
|
|
*/ |
20
|
|
|
class EntityFactory implements EntityFactoryInterface |
21
|
|
|
{ |
22
|
|
|
/** @var HelperFactory */ |
23
|
|
|
private $helperFactory; |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* @param HelperFactory $helperFactory |
27
|
|
|
*/ |
28
|
33 |
|
public function __construct(HelperFactory $helperFactory) |
29
|
|
|
{ |
30
|
33 |
|
$this->helperFactory = $helperFactory; |
31
|
33 |
|
} |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* @param string $filePath Path of the file to be read |
35
|
|
|
* @param \Box\Spout\Common\Manager\OptionsManagerInterface $optionsManager Reader's options manager |
36
|
|
|
* @return SheetIterator |
37
|
|
|
*/ |
38
|
30 |
|
public function createSheetIterator($filePath, $optionsManager) |
39
|
|
|
{ |
40
|
30 |
|
return new SheetIterator($filePath, $optionsManager, $this, $this->helperFactory); |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* @param XMLReader $xmlReader XML Reader |
45
|
|
|
* @param int $sheetIndex Index of the sheet, based on order in the workbook (zero-based) |
46
|
|
|
* @param string $sheetName Name of the sheet |
47
|
|
|
* @param bool $isSheetActive Whether the sheet was defined as active |
48
|
|
|
* @param \Box\Spout\Common\Manager\OptionsManagerInterface $optionsManager Reader's options manager |
49
|
|
|
* @return Sheet |
50
|
|
|
*/ |
51
|
28 |
|
public function createSheet($xmlReader, $sheetIndex, $sheetName, $isSheetActive, $optionsManager) |
52
|
|
|
{ |
53
|
28 |
|
return new Sheet($xmlReader, $sheetIndex, $sheetName, $isSheetActive, $optionsManager, $this); |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* @param XMLReader $xmlReader XML Reader |
58
|
|
|
* @param \Box\Spout\Common\Manager\OptionsManagerInterface $optionsManager Reader's options manager |
59
|
|
|
* @return RowIterator |
60
|
|
|
*/ |
61
|
28 |
|
public function createRowIterator($xmlReader, $optionsManager) |
62
|
|
|
{ |
63
|
28 |
|
return new RowIterator($xmlReader, $optionsManager, $this, $this->helperFactory); |
64
|
|
|
} |
65
|
|
|
|
66
|
|
|
/** |
67
|
|
|
* @return XMLReader |
68
|
|
|
*/ |
69
|
30 |
|
public function createXMLReader() |
70
|
|
|
{ |
71
|
30 |
|
return new XMLReader(); |
72
|
|
|
} |
73
|
|
|
|
74
|
|
|
/** |
75
|
|
|
* @param $xmlReader |
76
|
|
|
* @return XMLProcessor |
77
|
|
|
*/ |
78
|
28 |
|
public function createXMLProcessor($xmlReader) |
79
|
|
|
{ |
80
|
28 |
|
return new XMLProcessor($xmlReader); |
81
|
|
|
} |
82
|
|
|
|
83
|
|
|
/** |
84
|
|
|
* @return \ZipArchive |
85
|
|
|
*/ |
86
|
30 |
|
public function createZipArchive() |
87
|
|
|
{ |
88
|
30 |
|
return new \ZipArchive(); |
89
|
|
|
} |
90
|
|
|
} |
91
|
|
|
|