|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Box\Spout\Writer\XLSX\Creator; |
|
4
|
|
|
|
|
5
|
|
|
use Box\Spout\Common\Helper\Escaper; |
|
6
|
|
|
use Box\Spout\Common\Helper\StringHelper; |
|
7
|
|
|
use Box\Spout\Writer\Common\Creator\EntityFactory; |
|
8
|
|
|
use Box\Spout\Writer\Common\Entity\Options; |
|
9
|
|
|
use Box\Spout\Writer\Common\Helper\ZipHelper; |
|
10
|
|
|
use Box\Spout\Common\Manager\OptionsManagerInterface; |
|
11
|
|
|
use Box\Spout\Writer\XLSX\Helper\FileSystemHelper; |
|
12
|
|
|
|
|
13
|
|
|
/** |
|
14
|
|
|
* Class HelperFactory |
|
15
|
|
|
* Factory for helpers needed by the XLSX Writer |
|
16
|
|
|
* |
|
17
|
|
|
* @package Box\Spout\Writer\XLSX\Creator |
|
18
|
|
|
*/ |
|
19
|
|
|
class HelperFactory extends \Box\Spout\Common\Creator\HelperFactory |
|
20
|
|
|
{ |
|
21
|
|
|
/** |
|
22
|
|
|
* @param OptionsManagerInterface $optionsManager |
|
23
|
|
|
* @param EntityFactory $entityFactory |
|
24
|
|
|
* @return FileSystemHelper |
|
25
|
|
|
*/ |
|
26
|
46 |
|
public function createSpecificFileSystemHelper(OptionsManagerInterface $optionsManager, EntityFactory $entityFactory) |
|
27
|
|
|
{ |
|
28
|
46 |
|
$tempFolder = $optionsManager->getOption(Options::TEMP_FOLDER); |
|
29
|
46 |
|
$zipHelper = $this->createZipHelper($entityFactory); |
|
30
|
46 |
|
$escaper = $this->createStringsEscaper(); |
|
31
|
|
|
|
|
32
|
46 |
|
return new FileSystemHelper($tempFolder, $zipHelper, $escaper); |
|
33
|
|
|
} |
|
34
|
|
|
|
|
35
|
|
|
/** |
|
36
|
|
|
* @param EntityFactory $entityFactory |
|
37
|
|
|
* @return ZipHelper |
|
38
|
|
|
*/ |
|
39
|
46 |
|
private function createZipHelper(EntityFactory $entityFactory) |
|
40
|
|
|
{ |
|
41
|
46 |
|
return new ZipHelper($entityFactory); |
|
42
|
|
|
} |
|
43
|
|
|
|
|
44
|
|
|
/** |
|
45
|
|
|
* @return Escaper\XLSX |
|
46
|
|
|
*/ |
|
47
|
46 |
|
public function createStringsEscaper() |
|
48
|
|
|
{ |
|
49
|
46 |
|
return new Escaper\XLSX(); |
|
50
|
|
|
} |
|
51
|
|
|
|
|
52
|
|
|
/** |
|
53
|
|
|
* @return StringHelper |
|
54
|
|
|
*/ |
|
55
|
46 |
|
public function createStringHelper() |
|
56
|
|
|
{ |
|
57
|
46 |
|
return new StringHelper(); |
|
58
|
|
|
} |
|
59
|
|
|
} |
|
60
|
|
|
|