Passed
Branch development (bc47df)
by Theodoros
05:07
created

EcondaFacade::exportCategories()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 17
Code Lines 10

Duplication

Lines 17
Ratio 100 %

Importance

Changes 0
Metric Value
cc 1
eloc 10
nc 1
nop 4
dl 17
loc 17
rs 9.4285
c 0
b 0
f 0
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;
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\Business\AbstractFacade;
12
use SprykerEco\Zed\Econda\Business\Exporter\Writer\WriterInterface;
13
use SprykerEco\Zed\Econda\Business\Model\BatchResultInterface;
14
use Symfony\Component\Console\Output\OutputInterface;
15
16
/**
17
 * @method \SprykerEco\Zed\Econda\Business\EcondaBusinessFactory getFactory()
18
 */
19
class EcondaFacade extends AbstractFacade implements EcondaFacadeInterface
20
{
21
22
    /**
23
     * @api
24
     *
25
     * @param string $type
26
     * @param string $locale
27
     *
28
     * @return mixed
29
     */
30
    public function getFileContent($type, $locale)
31
    {
32
        return $this->getFactory()->getEcondaCsvFileContent($type, $locale);
33
    }
34
35
    /**
36
     * Specification:
37
     * - Initiates export into a file
38
     *
39
     * @api
40
     *
41
     * @param \Symfony\Component\Console\Output\OutputInterface $output
42
     *
43
     * @return \SprykerEco\Zed\Econda\Business\Model\BatchResultInterface[]
44
     */
45
    public function exportFile(OutputInterface $output)
46
    {
47
        $exporter = $this->getFactory()->createRunner();
48
        return $exporter->runExport($output);
49
    }
50
51
    /**
52
     * @api
53
     *
54
     * @param \Generated\Shared\Transfer\LocaleTransfer $localeTransfer
55
     * @param \SprykerEco\Zed\Econda\Business\Model\BatchResultInterface $result
56
     * @param \SprykerEco\Zed\Econda\Business\Exporter\Writer\WriterInterface $dataWriter
57
     * @param \Symfony\Component\Console\Output\OutputInterface $output
58
     *
59
     * @return void
60
     */
61 View Code Duplication
    public function exportCategories(
1 ignored issue
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
62
        LocaleTransfer $localeTransfer,
63
        BatchResultInterface $result,
64
        WriterInterface $dataWriter,
65
        OutputInterface $output
66
    ) {
67
        $collector = $this->getFactory()
68
            ->createFileCategoryCollector();
69
70
        $this->getFactory()
71
            ->createCollectorManager()
72
            ->runCollector(
73
                $collector,
74
                $localeTransfer,
75
                $result,
76
                $dataWriter,
77
                $output
78
            );
79
    }
80
81
    /**
82
     * @api
83
     *
84
     * @param \Generated\Shared\Transfer\LocaleTransfer $localeTransfer
85
     * @param \SprykerEco\Zed\Econda\Business\Model\BatchResultInterface $result
86
     * @param \SprykerEco\Zed\Econda\Business\Exporter\Writer\WriterInterface $dataWriter
87
     * @param \Symfony\Component\Console\Output\OutputInterface $output
88
     *
89
     * @return void
90
     */
91 View Code Duplication
    public function exportProducts(
1 ignored issue
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
92
        LocaleTransfer $localeTransfer,
93
        BatchResultInterface $result,
94
        WriterInterface $dataWriter,
95
        OutputInterface $output
96
    ) {
97
        $collector = $this->getFactory()
98
            ->createFileProductCollector();
99
100
        $this->getFactory()
101
            ->createCollectorManager()
102
            ->runCollector(
103
                $collector,
104
                $localeTransfer,
105
                $result,
106
                $dataWriter,
107
                $output
108
            );
109
    }
110
111
}
112