|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Box\Spout\Reader\XLSX\Creator; |
|
4
|
|
|
|
|
5
|
|
|
use Box\Spout\Reader\XLSX\Manager\SharedStringsCaching\CachingStrategyFactory; |
|
6
|
|
|
use Box\Spout\Reader\XLSX\Manager\SharedStringsManager; |
|
7
|
|
|
use Box\Spout\Reader\XLSX\Manager\SheetManager; |
|
8
|
|
|
use Box\Spout\Reader\XLSX\Manager\StyleManager; |
|
9
|
|
|
|
|
10
|
|
|
|
|
11
|
|
|
/** |
|
12
|
|
|
* Class ManagerFactory |
|
13
|
|
|
* Factory to create managers |
|
14
|
|
|
* |
|
15
|
|
|
* @package Box\Spout\Reader\XLSX\Creator |
|
16
|
|
|
*/ |
|
17
|
|
|
class ManagerFactory |
|
18
|
|
|
{ |
|
19
|
|
|
/** @var HelperFactory */ |
|
20
|
|
|
private $helperFactory; |
|
21
|
|
|
|
|
22
|
|
|
/** @var CachingStrategyFactory */ |
|
23
|
|
|
private $cachingStrategyFactory; |
|
24
|
|
|
|
|
25
|
|
|
/** |
|
26
|
|
|
* @param HelperFactory $helperFactory Factory to create helpers |
|
27
|
|
|
* @param CachingStrategyFactory $cachingStrategyFactory Factory to create shared strings caching strategies |
|
28
|
|
|
*/ |
|
29
|
78 |
|
public function __construct(HelperFactory $helperFactory, CachingStrategyFactory $cachingStrategyFactory) |
|
30
|
|
|
{ |
|
31
|
78 |
|
$this->helperFactory = $helperFactory; |
|
32
|
78 |
|
$this->cachingStrategyFactory = $cachingStrategyFactory; |
|
33
|
78 |
|
} |
|
34
|
|
|
|
|
35
|
|
|
/** |
|
36
|
|
|
* @param string $filePath Path of the XLSX file being read |
|
37
|
|
|
* @param string $tempFolder Temporary folder where the temporary files to store shared strings will be stored |
|
38
|
|
|
* @param EntityFactory $entityFactory Factory to create entities |
|
39
|
|
|
* @return SharedStringsManager |
|
40
|
|
|
*/ |
|
41
|
35 |
|
public function createSharedStringsManager($filePath, $tempFolder, $entityFactory) |
|
42
|
|
|
{ |
|
43
|
35 |
|
return new SharedStringsManager($filePath, $tempFolder, $entityFactory, $this->helperFactory, $this->cachingStrategyFactory); |
|
44
|
|
|
} |
|
45
|
|
|
|
|
46
|
|
|
/** |
|
47
|
|
|
* @param string $filePath Path of the XLSX file being read |
|
48
|
|
|
* @param \Box\Spout\Common\Manager\OptionsManagerInterface $optionsManager Reader's options manager |
|
49
|
|
|
* @param \Box\Spout\Reader\XLSX\Manager\SharedStringsManager $sharedStringsManager Manages shared strings |
|
50
|
|
|
* @param EntityFactory $entityFactory Factory to create entities |
|
51
|
|
|
* @return SheetManager |
|
52
|
|
|
*/ |
|
53
|
34 |
|
public function createSheetManager($filePath, $optionsManager, $sharedStringsManager, $entityFactory) |
|
54
|
|
|
{ |
|
55
|
34 |
|
$escaper = $this->helperFactory->createStringsEscaper(); |
|
56
|
34 |
|
return new SheetManager($filePath, $optionsManager, $sharedStringsManager, $escaper, $entityFactory); |
|
57
|
|
|
} |
|
58
|
|
|
|
|
59
|
|
|
/** |
|
60
|
|
|
* @param string $filePath Path of the XLSX file being read |
|
61
|
|
|
* @param EntityFactory $entityFactory Factory to create entities |
|
62
|
|
|
* @return StyleManager |
|
63
|
|
|
*/ |
|
64
|
33 |
|
public function createStyleManager($filePath, $entityFactory) |
|
65
|
|
|
{ |
|
66
|
33 |
|
return new StyleManager($filePath, $entityFactory); |
|
67
|
|
|
} |
|
68
|
|
|
} |
|
69
|
|
|
|