Passed
Push — master ( 1fb483...35eebd )
by Roman
04:31
created

SearchWordDefinitionMessageHandler::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 2
dl 0
loc 6
ccs 0
cts 3
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace App\Dictionary\Features\PopulateStorage\Populate\Message;
6
7
use App\Dictionary\Features\PopulateStorage\Populate\Port\WordDefinitionApiGatewayInterface;
8
use App\Dictionary\Features\PopulateStorage\SaveStorage\Message\SaveToStorageMessage;
9
use Symfony\Component\Messenger\Handler\MessageHandlerInterface;
0 ignored issues
show
Bug introduced by
The type Symfony\Component\Messen...MessageHandlerInterface 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...
10
use Symfony\Component\Messenger\MessageBusInterface;
0 ignored issues
show
Bug introduced by
The type Symfony\Component\Messenger\MessageBusInterface 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...
11
12
final class SearchWordDefinitionMessageHandler implements MessageHandlerInterface
13
{
14
    private MessageBusInterface $messageBus;
15
    private WordDefinitionApiGatewayInterface $wordsDefinitionApiGateway;
16
17
    public function __construct(
18
        MessageBusInterface $messageBus,
19
        WordDefinitionApiGatewayInterface $wordsDefinitionApiGateway
20
    ) {
21
        $this->messageBus = $messageBus;
22
        $this->wordsDefinitionApiGateway = $wordsDefinitionApiGateway;
23
    }
24
25 2
    public function __invoke(SearchWordDefinitionMessage $message): void
26
    {
27 2
        $definition = $this->wordsDefinitionApiGateway->search($message->word(), $message->language());
28 1
        $this->messageBus->dispatch(new SaveToStorageMessage($message->word(), $definition, $message->language()));
29 1
    }
30
}
31