EtlExecutionHandler::__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\MessageHandler;
4
5
use Oliverde8\PhpEtlBundle\Message\EtlExecutionMessage;
6
use Oliverde8\PhpEtlBundle\Repository\EtlExecutionRepository;
7
use Oliverde8\PhpEtlBundle\Services\ChainProcessorsManager;
8
use Symfony\Component\Messenger\Handler\MessageHandlerInterface;
9
10
class EtlExecutionHandler implements MessageHandlerInterface
11
{
12
    /** @var ChainProcessorsManager */
13
    protected $chainProcessorManager;
14
15
    /** @var EtlExecutionRepository */
16
    protected $etlExecutionRepository;
17
18
    /**
19
     * EtlExecutionHandler constructor.
20
     * @param ChainProcessorsManager $chainProcessorManager
21
     * @param EtlExecutionRepository $etlExecutionRepository
22
     */
23
    public function __construct(ChainProcessorsManager $chainProcessorManager, EtlExecutionRepository $etlExecutionRepository)
24
    {
25
        $this->chainProcessorManager = $chainProcessorManager;
26
        $this->etlExecutionRepository = $etlExecutionRepository;
27
    }
28
29
    public function __invoke(EtlExecutionMessage $message)
30
    {
31
        $execution = $this->etlExecutionRepository->find($message->getId());
32
        $this->chainProcessorManager->executeFromEtlEntity($execution);
0 ignored issues
show
Bug introduced by
It seems like $execution can also be of type null; however, parameter $execution of Oliverde8\PhpEtlBundle\S...:executeFromEtlEntity() does only seem to accept Oliverde8\PhpEtlBundle\Entity\EtlExecution, maybe add an additional type check? ( Ignorable by Annotation )

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

32
        $this->chainProcessorManager->executeFromEtlEntity(/** @scrutinizer ignore-type */ $execution);
Loading history...
33
    }
34
}
35