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

CollectorManager::runCollector()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 5
dl 0
loc 11
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\Manager;
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\Shared\SqlCriteriaBuilder\CriteriaBuilder\CriteriaBuilderInterface;
0 ignored issues
show
Bug introduced by
The type Spryker\Shared\SqlCriter...riteriaBuilderInterface 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\Collector\DatabaseCollectorInterface;
13
use SprykerEco\Zed\Econda\Business\Exporter\Writer\WriterInterface;
14
use SprykerEco\Zed\Econda\Business\Helper\ProgressBarHelper;
15
use SprykerEco\Zed\Econda\Business\Model\BatchResultInterface;
16
use SprykerEco\Zed\Econda\Persistence\EcondaQueryContainerInterface;
17
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...
18
19
class CollectorManager implements CollectorManagerInterface
20
{
21
22
    /**
23
     * @var \Spryker\Shared\SqlCriteriaBuilder\CriteriaBuilder\CriteriaBuilderInterface
24
     */
25
    protected $criteriaBuilder;
26
27
    /**
28
     * @var \SprykerEco\Zed\Econda\Persistence\EcondaQueryContainerInterface
29
     */
30
    protected $queryContainer;
31
32
    /** @var \SprykerEco\Zed\Econda\Business\Helper\ProgressBarHelper */
33
    protected $progressBarHelper;
34
35
    /**
36
     * CollectorManager constructor.
37
     *
38
     * @param \Spryker\Shared\SqlCriteriaBuilder\CriteriaBuilder\CriteriaBuilderInterface $criteriaBuilder
39
     * @param \SprykerEco\Zed\Econda\Persistence\EcondaQueryContainerInterface $queryContainer
40
     * @param \SprykerEco\Zed\Econda\Business\Helper\ProgressBarHelper $progressBarHelper
41
     */
42
    public function __construct(
43
        CriteriaBuilderInterface $criteriaBuilder,
44
        EcondaQueryContainerInterface $queryContainer,
45
        ProgressBarHelper $progressBarHelper
46
    ) {
47
        $this->criteriaBuilder = $criteriaBuilder;
48
        $this->queryContainer = $queryContainer;
49
        $this->progressBarHelper = $progressBarHelper;
50
    }
51
52
    /**
53
     * @param \SprykerEco\Zed\Econda\Business\Collector\DatabaseCollectorInterface $collector
54
     * @param \Generated\Shared\Transfer\LocaleTransfer $locale
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
    public function runCollector(
62
        DatabaseCollectorInterface $collector,
63
        LocaleTransfer $locale,
64
        BatchResultInterface $result,
65
        WriterInterface $dataWriter,
66
        OutputInterface $output
67
    ) {
68
        $batchCollection = $collector->createIteratorAndPrepareQuery($locale, $this->criteriaBuilder, $this->queryContainer);
69
        $progressBar = $this->progressBarHelper->startProgressBar($output, '', $batchCollection->count());
70
71
        $collector->exportDataToStore($batchCollection, $result, $dataWriter, $locale, $output, $progressBar);
72
    }
73
74
}
75