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

AbstractExporter::getCollectorPlugins()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
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\Exporter;
9
10
use SprykerEco\Zed\Econda\Business\Exporter\Writer\WriterInterface;
11
use SprykerEco\Zed\Econda\Business\Model\BatchResultInterface;
12
use SprykerEco\Zed\Econda\Business\Model\FailedResultInterface;
13
14
abstract class AbstractExporter implements ExporterInterface
15
{
16
17
    /**
18
     * @var \SprykerEco\Zed\Econda\Dependency\Plugin\EcondaPluginInterface[]
19
     */
20
    protected $collectorPlugins = [];
21
22
    /**
23
     * @var \SprykerEco\Zed\Econda\Business\Model\FailedResultInterface
24
     */
25
    protected $failedResultPrototype;
26
27
    /**
28
     * @var \SprykerEco\Zed\Econda\Business\Model\BatchResultInterface
29
     */
30
    protected $batchResultPrototype;
31
32
    /**
33
     * @var \SprykerEco\Zed\Econda\Business\Exporter\Writer\WriterInterface
34
     */
35
    protected $writer;
36
37
    /**
38
     * @var \Spryker\Zed\Touch\Persistence\TouchQueryContainerInterface
0 ignored issues
show
Bug introduced by
The type Spryker\Zed\Touch\Persis...QueryContainerInterface 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...
39
     */
40
    protected $queryContainer;
41
42
    /**
43
     * @param \SprykerEco\Zed\Econda\Business\Exporter\Writer\WriterInterface $writer
44
     * @param \SprykerEco\Zed\Econda\Business\Model\FailedResultInterface $failedResultPrototype
45
     * @param \SprykerEco\Zed\Econda\Business\Model\BatchResultInterface $batchResultPrototype
46
     * @param \SprykerEco\Zed\Econda\Dependency\Plugin\EcondaPluginInterface[] $collectorPlugins
47
     */
48
    public function __construct(
49
        WriterInterface $writer,
50
        FailedResultInterface $failedResultPrototype,
51
        BatchResultInterface $batchResultPrototype,
52
        array $collectorPlugins = []
53
    ) {
54
        $this->writer = $writer;
55
        $this->failedResultPrototype = $failedResultPrototype;
56
        $this->batchResultPrototype = $batchResultPrototype;
57
        $this->collectorPlugins = $collectorPlugins;
58
    }
59
60
    /**
61
     * @return \SprykerEco\Zed\Econda\Dependency\Plugin\EcondaPluginInterface[]
62
     */
63
    public function getCollectorPlugins()
64
    {
65
        return $this->collectorPlugins;
66
    }
67
68
    /**
69
     * @param string $type
70
     *
71
     * @return bool
72
     */
73
    protected function isCollectorRegistered($type)
74
    {
75
        return array_key_exists($type, $this->collectorPlugins);
76
    }
77
78
    /**
79
     * @param \SprykerEco\Zed\Econda\Business\Model\BatchResultInterface $result
80
     *
81
     * @return void
82
     */
83
    protected function resetResult(BatchResultInterface $result)
84
    {
85
        $result->setProcessedCount(0);
86
        $result->setIsFailed(false);
87
        $result->setTotalCount(0);
88
        $result->setDeletedCount(0);
89
    }
90
91
}
92