FindOldExecutionsOperation::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
nc 1
nop 2
1
<?php
2
3
namespace Oliverde8\PhpEtlBundle\Etl\Operation\Cleanup;
4
5
use Oliverde8\Component\PhpEtl\ChainOperation\AbstractChainOperation;
6
use Oliverde8\Component\PhpEtl\Item\GroupedItem;
7
use Oliverde8\Component\PhpEtl\Item\ItemInterface;
8
use Oliverde8\Component\PhpEtl\Item\StopItem;
9
use Oliverde8\Component\PhpEtl\Model\ExecutionContext;
10
use Oliverde8\PhpEtlBundle\Repository\EtlExecutionRepository;
11
12
class FindOldExecutionsOperation extends AbstractChainOperation
13
{
14
    protected EtlExecutionRepository $etlExecutionRepository;
15
16
    protected \DateTime $minKeep;
17
18
    protected $endProcess = false;
19
20
    /**
21
     * FindOldExecutions constructor.
22
     * @param EtlExecutionRepository $etlExecutionRepository
23
     * @param string $minKeep
24
     */
25
    public function __construct(EtlExecutionRepository $etlExecutionRepository, \DateTime $minKeep)
26
    {
27
        $this->etlExecutionRepository = $etlExecutionRepository;
28
        $this->minKeep = $minKeep;
29
    }
30
31
    protected function processStop(StopItem $item, ExecutionContext $context): ItemInterface
0 ignored issues
show
Unused Code introduced by
The parameter $context is not used and could be removed. ( Ignorable by Annotation )

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

31
    protected function processStop(StopItem $item, /** @scrutinizer ignore-unused */ ExecutionContext $context): ItemInterface

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
32
    {
33
        if ($this->endProcess) {
34
            return $item;
35
        }
36
37
        $this->endProcess = true;
38
        $iterator = $this->etlExecutionRepository->getOldExecutions($this->minKeep);
39
40
        return new GroupedItem($iterator);
41
    }
42
}