|
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\BatchResultTransfer; |
|
|
|
|
|
|
11
|
|
|
use Generated\Shared\Transfer\LocaleTransfer; |
|
|
|
|
|
|
12
|
|
|
use SprykerEco\Zed\Econda\Business\Exporter\Writer\File\FileWriterInterface; |
|
13
|
|
|
use SprykerEco\Zed\Econda\Business\Exporter\Writer\File\NameGenerator\NameGeneratorInterface; |
|
14
|
|
|
use Symfony\Component\Console\Output\OutputInterface; |
|
15
|
|
|
|
|
16
|
|
|
class FileExporter extends AbstractExporter |
|
17
|
|
|
{ |
|
18
|
|
|
/** |
|
19
|
|
|
* @var \SprykerEco\Zed\Econda\Business\Exporter\Writer\File\FileWriterInterface |
|
20
|
|
|
*/ |
|
21
|
|
|
protected $writer; |
|
22
|
|
|
|
|
23
|
|
|
/** |
|
24
|
|
|
* @var \SprykerEco\Zed\Econda\Business\Exporter\Writer\File\NameGenerator\NameGeneratorInterface |
|
25
|
|
|
*/ |
|
26
|
|
|
protected $csvNameGenerator; |
|
27
|
|
|
|
|
28
|
|
|
/** |
|
29
|
|
|
* @var string |
|
30
|
|
|
*/ |
|
31
|
|
|
protected $exportPath; |
|
32
|
|
|
|
|
33
|
|
|
/** |
|
34
|
|
|
* @param \SprykerEco\Zed\Econda\Business\Exporter\Writer\File\FileWriterInterface $writer |
|
35
|
|
|
* @param \SprykerEco\Zed\Econda\Business\Exporter\Writer\File\NameGenerator\NameGeneratorInterface $csvNameGenerator |
|
36
|
|
|
* @param string $exportPath |
|
37
|
|
|
* @param array $collectorPlugins |
|
38
|
|
|
*/ |
|
39
|
|
|
public function __construct( |
|
40
|
|
|
FileWriterInterface $writer, |
|
41
|
|
|
NameGeneratorInterface $csvNameGenerator, |
|
42
|
|
|
$exportPath, |
|
43
|
|
|
array $collectorPlugins = [] |
|
44
|
|
|
) { |
|
45
|
|
|
parent::__construct( |
|
46
|
|
|
$writer, |
|
47
|
|
|
$collectorPlugins |
|
48
|
|
|
); |
|
49
|
|
|
|
|
50
|
|
|
$this->csvNameGenerator = $csvNameGenerator; |
|
51
|
|
|
$this->exportPath = $exportPath; |
|
52
|
|
|
} |
|
53
|
|
|
|
|
54
|
|
|
/** |
|
55
|
|
|
* @param string $type |
|
56
|
|
|
* @param \Generated\Shared\Transfer\LocaleTransfer $localeTransfer |
|
57
|
|
|
* @param \Symfony\Component\Console\Output\OutputInterface $output |
|
58
|
|
|
* |
|
59
|
|
|
* @return \Generated\Shared\Transfer\BatchResultTransfer |
|
60
|
|
|
*/ |
|
61
|
|
|
public function exportByType($type, LocaleTransfer $localeTransfer, OutputInterface $output): BatchResultTransfer |
|
62
|
|
|
{ |
|
63
|
|
|
$result = $this->createDefaultBatchResultTransfer(); |
|
64
|
|
|
$result->setProcessedLocale($localeTransfer); |
|
65
|
|
|
|
|
66
|
|
|
if (!$this->isCollectorRegistered($type)) { |
|
67
|
|
|
$this->resetResult($result); |
|
68
|
|
|
|
|
69
|
|
|
return $result; |
|
70
|
|
|
} |
|
71
|
|
|
|
|
72
|
|
|
$fileName = $this->csvNameGenerator->generateFileName($type, $localeTransfer->getLocaleName()); |
|
73
|
|
|
$this->writer->setFileName($fileName); |
|
74
|
|
|
$this->writer->setFolderPath($this->exportPath); |
|
75
|
|
|
|
|
76
|
|
|
$collectorPlugin = $this->collectorPlugins[$type]; |
|
77
|
|
|
$collectorPlugin->run($localeTransfer, $result, $this->writer, $output); |
|
78
|
|
|
|
|
79
|
|
|
return $result; |
|
80
|
|
|
} |
|
81
|
|
|
} |
|
82
|
|
|
|
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