1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* MIT License |
5
|
|
|
* Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file. |
6
|
|
|
*/ |
7
|
|
|
|
8
|
|
|
namespace SprykerEco\Zed\Econda\Business\Exporter; |
9
|
|
|
|
10
|
|
|
use Generated\Shared\Transfer\LocaleTransfer; |
|
|
|
|
11
|
|
|
use SprykerEco\Zed\Econda\Business\Exporter\Writer\File\NameGenerator\CsvNameGenerator; |
12
|
|
|
use SprykerEco\Zed\Econda\Business\Exporter\Writer\WriterInterface; |
13
|
|
|
use SprykerEco\Zed\Econda\Business\Model\BatchResultInterface; |
14
|
|
|
use SprykerEco\Zed\Econda\Business\Model\FailedResultInterface; |
15
|
|
|
use Symfony\Component\Console\Output\OutputInterface; |
|
|
|
|
16
|
|
|
|
17
|
|
|
class FileExporter extends AbstractExporter |
18
|
|
|
{ |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* @var \SprykerEco\Zed\Econda\Business\Exporter\Writer\File\FileWriter |
22
|
|
|
*/ |
23
|
|
|
protected $writer; |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* @var \SprykerEco\Zed\Econda\Business\Exporter\Writer\File\NameGenerator\CsvNameGenerator |
27
|
|
|
*/ |
28
|
|
|
protected $csvNameGenerator; |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* @var string |
32
|
|
|
*/ |
33
|
|
|
protected $exportPath; |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* FileExporter constructor. |
37
|
|
|
* |
38
|
|
|
* @param \SprykerEco\Zed\Econda\Business\Exporter\Writer\WriterInterface $writer |
39
|
|
|
* @param \SprykerEco\Zed\Econda\Business\Model\FailedResultInterface $failedResultPrototype |
40
|
|
|
* @param \SprykerEco\Zed\Econda\Business\Model\BatchResultInterface $batchResultPrototype |
41
|
|
|
* @param \SprykerEco\Zed\Econda\Business\Exporter\Writer\File\NameGenerator\CsvNameGenerator $csvNameGenerator |
42
|
|
|
* @param string $exportPath |
43
|
|
|
* @param array $collectorPlugins |
44
|
|
|
*/ |
45
|
|
|
public function __construct( |
46
|
|
|
WriterInterface $writer, |
47
|
|
|
FailedResultInterface $failedResultPrototype, |
48
|
|
|
BatchResultInterface $batchResultPrototype, |
49
|
|
|
CsvNameGenerator $csvNameGenerator, |
50
|
|
|
$exportPath, |
51
|
|
|
array $collectorPlugins = [] |
52
|
|
|
) { |
53
|
|
|
parent::__construct( |
54
|
|
|
$writer, |
55
|
|
|
$failedResultPrototype, |
56
|
|
|
$batchResultPrototype, |
57
|
|
|
$collectorPlugins |
58
|
|
|
); |
59
|
|
|
|
60
|
|
|
$this->csvNameGenerator = $csvNameGenerator; |
61
|
|
|
$this->exportPath = $exportPath; |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* @param string $type |
66
|
|
|
* @param \Generated\Shared\Transfer\LocaleTransfer $localeTransfer |
67
|
|
|
* @param \Symfony\Component\Console\Output\OutputInterface $output |
68
|
|
|
* |
69
|
|
|
* @return \SprykerEco\Zed\Econda\Business\Model\BatchResultInterface |
70
|
|
|
*/ |
71
|
|
|
public function exportByType($type, LocaleTransfer $localeTransfer, OutputInterface $output) |
72
|
|
|
{ |
73
|
|
|
$result = clone $this->batchResultPrototype; |
74
|
|
|
$result->setProcessedLocale($localeTransfer); |
75
|
|
|
|
76
|
|
|
if (!$this->isCollectorRegistered($type)) { |
77
|
|
|
$this->resetResult($result); |
78
|
|
|
|
79
|
|
|
return $result; |
80
|
|
|
} |
81
|
|
|
|
82
|
|
|
$fileName = $this->csvNameGenerator->generateFileName($type, $localeTransfer->getLocaleName()); |
83
|
|
|
$this->writer->setFileName($fileName); |
84
|
|
|
$this->writer->setFolderPath($this->exportPath); |
85
|
|
|
|
86
|
|
|
$collectorPlugin = $this->collectorPlugins[$type]; |
87
|
|
|
$collectorPlugin->run($localeTransfer, $result, $this->writer, $output); |
88
|
|
|
|
89
|
|
|
return $result; |
90
|
|
|
} |
91
|
|
|
|
92
|
|
|
} |
93
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths