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
|
|||
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 | } |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.