Passed
Branch development (0519a2)
by Theodoros
02:02
created

ProductsPlugin   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 28
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A run() 0 17 2
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\Communication\Plugin;
9
10
use Generated\Shared\Transfer\LocaleTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfer\LocaleTransfer was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
11
use Spryker\Zed\Kernel\Communication\AbstractPlugin;
0 ignored issues
show
Bug introduced by
The type Spryker\Zed\Kernel\Communication\AbstractPlugin was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
12
use SprykerEco\Zed\Econda\Business\Exporter\Writer\WriterInterface;
13
use SprykerEco\Zed\Econda\Business\Model\BatchResultInterface;
14
use SprykerEco\Zed\Econda\Dependency\Plugin\EcondaPluginInterface;
15
use Symfony\Component\Console\Output\OutputInterface;
0 ignored issues
show
Bug introduced by
The type Symfony\Component\Console\Output\OutputInterface was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
16
17
/**
18
 * @method \SprykerEco\Zed\Econda\Business\EcondaFacade getFacade()
19
 * @method \SprykerEco\Zed\Econda\EcondaConfig getConfig()
20
 */
21
class ProductsPlugin extends AbstractPlugin implements EcondaPluginInterface
22
{
23
24
    /**
25
     * @param \Generated\Shared\Transfer\LocaleTransfer $locale
26
     * @param \SprykerEco\Zed\Econda\Business\Model\BatchResultInterface $result
27
     * @param \SprykerEco\Zed\Econda\Business\Exporter\Writer\WriterInterface $dataWriter
28
     * @param \Symfony\Component\Console\Output\OutputInterface $output
29
     *
30
     * @return void
31
     */
32
    public function run(
33
        LocaleTransfer $locale,
34
        BatchResultInterface $result,
35
        WriterInterface $dataWriter,
36
        OutputInterface $output
37
    ) {
38
        $csvDir = $this->getConfig()->getFileExportPath();
39
        if (!is_dir($csvDir)) {
40
            mkdir($csvDir);
41
        }
42
        $dataWriter->setFolderPath($csvDir);
43
        $this->getFacade()
44
            ->exportProducts(
45
                $locale,
46
                $result,
47
                $dataWriter,
48
                $output
49
            );
50
    }
51
52
}
53