Passed
Branch development (62ef01)
by Theodoros
06:18
created

ProductsPlugin   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 27
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\BatchResultTransfer;
11
use Generated\Shared\Transfer\LocaleTransfer;
12
use Spryker\Zed\Kernel\Communication\AbstractPlugin;
13
use SprykerEco\Zed\Econda\Business\Exporter\Writer\WriterInterface;
14
use SprykerEco\Zed\Econda\Dependency\Plugin\EcondaPluginInterface;
15
use Symfony\Component\Console\Output\OutputInterface;
16
17
/**
18
 * @method \SprykerEco\Zed\Econda\Business\EcondaFacade getFacade()
19
 * @method \SprykerEco\Zed\Econda\EcondaConfig getConfig()
20
 * @method \SprykerEco\Zed\Econda\Communication\EcondaCommunicationFactory getFactory()
21
 */
22
class ProductsPlugin extends AbstractPlugin implements EcondaPluginInterface
23
{
24
    /**
25
     * @param \Generated\Shared\Transfer\LocaleTransfer $locale
26
     * @param \Generated\Shared\Transfer\BatchResultTransfer $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
        BatchResultTransfer $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(
0 ignored issues
show
Bug introduced by
The method exportProducts() does not exist on SprykerEco\Zed\Econda\EcondaConfig. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

44
            ->/** @scrutinizer ignore-call */ exportProducts(

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
45
                $locale,
46
                $result,
47
                $dataWriter,
48
                $output
49
            );
50
    }
51
}
52