|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Akeneo\Component\SpreadsheetParser\Xlsx; |
|
4
|
|
|
|
|
5
|
|
|
/** |
|
6
|
|
|
* Row iterator factory |
|
7
|
|
|
* |
|
8
|
|
|
* @author Antoine Guigan <[email protected]> |
|
9
|
|
|
* @copyright 2014 Akeneo SAS (http://www.akeneo.com) |
|
10
|
|
|
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) |
|
11
|
|
|
*/ |
|
12
|
|
|
class RowIteratorFactory |
|
13
|
|
|
{ |
|
14
|
|
|
|
|
15
|
|
|
/** |
|
16
|
|
|
* |
|
17
|
|
|
* @var RowBuilderFactory |
|
18
|
|
|
*/ |
|
19
|
|
|
protected $rowBuilderFactory; |
|
20
|
|
|
|
|
21
|
|
|
/** |
|
22
|
|
|
* |
|
23
|
|
|
* @var ColumnIndexTransformer |
|
24
|
|
|
*/ |
|
25
|
|
|
protected $columnIndexTransformer; |
|
26
|
|
|
|
|
27
|
|
|
/** |
|
28
|
|
|
* |
|
29
|
|
|
* @var string |
|
30
|
|
|
*/ |
|
31
|
|
|
protected $iteratorClass; |
|
32
|
|
|
|
|
33
|
|
|
/** |
|
34
|
|
|
* Constructor |
|
35
|
|
|
* |
|
36
|
|
|
* @param RowBuilderFactory $rowBuilderFactory |
|
37
|
|
|
* @param ColumnIndexTransformer $columnIndexTransformer |
|
38
|
|
|
* @param string $iteratorClass the class for row iterators |
|
39
|
|
|
*/ |
|
40
|
|
|
public function __construct( |
|
41
|
|
|
RowBuilderFactory $rowBuilderFactory, |
|
42
|
|
|
ColumnIndexTransformer $columnIndexTransformer, |
|
43
|
|
|
$iteratorClass |
|
44
|
|
|
) { |
|
45
|
|
|
$this->rowBuilderFactory = $rowBuilderFactory; |
|
46
|
|
|
$this->columnIndexTransformer = $columnIndexTransformer; |
|
47
|
|
|
$this->iteratorClass = $iteratorClass; |
|
48
|
|
|
} |
|
49
|
|
|
|
|
50
|
|
|
/** |
|
51
|
|
|
* Creates a row iterator for the XML given worksheet file |
|
52
|
|
|
* |
|
53
|
|
|
* @param ValueTransformer $valueTransformer the value transformer for the spreadsheet |
|
54
|
|
|
* @param string $path the path to the extracted XML worksheet file |
|
55
|
|
|
* @param array $options options specific to the format |
|
56
|
|
|
* @param Archive $archive The Archive from which the path was extracted |
|
57
|
|
|
* |
|
58
|
|
|
* @return RowIterator |
|
59
|
|
|
*/ |
|
60
|
|
|
public function create(ValueTransformer $valueTransformer, $path, array $options, Archive $archive) |
|
61
|
|
|
{ |
|
62
|
|
|
return new $this->iteratorClass( |
|
63
|
|
|
$this->rowBuilderFactory, |
|
64
|
|
|
$this->columnIndexTransformer, |
|
65
|
|
|
$valueTransformer, |
|
66
|
|
|
$path, |
|
67
|
|
|
$options, |
|
68
|
|
|
$archive |
|
69
|
|
|
); |
|
70
|
|
|
} |
|
71
|
|
|
|
|
72
|
|
|
} |
|
73
|
|
|
|