Passed
Push — main ( bd03c4...c6ca62 )
by De Cramer
04:36
created

FindOldExecutionsOperation::__construct()   A

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\PhpEtlBundle\Repository\EtlExecutionRepository;
9
10
class FindOldExecutionsOperation extends AbstractChainOperation
11
{
12
    protected EtlExecutionRepository $etlExecutionRepository;
13
14
    protected \DateTime $minKeep;
15
16
    protected $endProcess = false;
17
18
    /**
19
     * FindOldExecutions constructor.
20
     * @param EtlExecutionRepository $etlExecutionRepository
21
     * @param string $minKeep
22
     */
23
    public function __construct(EtlExecutionRepository $etlExecutionRepository, \DateTime $minKeep)
24
    {
25
        $this->etlExecutionRepository = $etlExecutionRepository;
26
        $this->minKeep = $minKeep;
27
    }
28
29
    protected function processStop(ItemInterface $item, array &$context)
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

29
    protected function processStop(ItemInterface $item, /** @scrutinizer ignore-unused */ array &$context)

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...
30
    {
31
        if ($this->endProcess) {
32
            return $item;
33
        }
34
35
        $this->endProcess = true;
36
        $iterator = $this->etlExecutionRepository->getOldExecutions($this->minKeep);
37
38
        return new GroupedItem($iterator);
39
    }
40
}