Exporter   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 3
eloc 10
c 1
b 0
f 1
dl 0
loc 35
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A exportData() 0 10 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\Minubo\Business\Exporter;
9
10
use DateTime;
11
use Generated\Shared\Transfer\SpyMinuboRunEntityTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...MinuboRunEntityTransfer 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\Minubo\Persistence\MinuboEntityManagerInterface;
13
use SprykerEco\Zed\Minubo\Persistence\MinuboRepository;
14
15
class Exporter implements ExporterInterface
16
{
17
    /**
18
     * @var \SprykerEco\Zed\Minubo\Persistence\MinuboEntityManagerInterface
19
     */
20
    protected $entityManager;
21
22
    /**
23
     * @var array<\SprykerEco\Zed\Minubo\Dependency\Plugin\MinuboExportPluginInterface>
24
     */
25
    protected $exportPlugins;
26
27
    /**
28
     * @param \SprykerEco\Zed\Minubo\Persistence\MinuboEntityManagerInterface $entityManager
29
     * @param array<\SprykerEco\Zed\Minubo\Dependency\Plugin\MinuboExportPluginInterface> $exportPlugins
30
     */
31
    public function __construct(MinuboEntityManagerInterface $entityManager, array $exportPlugins)
32
    {
33
        $this->exportPlugins = $exportPlugins;
34
        $this->entityManager = $entityManager;
35
    }
36
37
    /**
38
     * @return void
39
     */
40
    public function exportData(): void
41
    {
42
        $minuboRunEntityTransfer = new SpyMinuboRunEntityTransfer();
43
        $minuboRunEntityTransfer->setRanAt((new DateTime())->format(MinuboRepository::LAST_RUN_DATETIME_FORMAT));
44
45
        foreach ($this->exportPlugins as $exportPlugin) {
46
            $exportPlugin->exportData();
47
        }
48
49
        $this->entityManager->createMinuboLastRun($minuboRunEntityTransfer);
50
    }
51
}
52