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

CrosswordGenerator::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
ccs 0
cts 2
cp 0
crap 2
rs 10
c 1
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace App\Crossword\Features\Generator;
6
7
use App\Crossword\Features\Constructor\Message\GenerateCrosswordMessage;
8
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...
9
10
final class CrosswordGenerator
11
{
12
    private MessageBusInterface $messageBus;
13
14
    public function __construct(MessageBusInterface $messageBus)
15
    {
16
        $this->messageBus = $messageBus;
17
    }
18
19 1
    public function generate(GenerateCriteria $criteria): void
20
    {
21 1
        $counter = 1;
22
        do {
23 1
            $this->messageBus->dispatch(
24 1
                new GenerateCrosswordMessage(
25 1
                    $criteria->language(),
26 1
                    $criteria->type(),
27 1
                    $criteria->wordCount()
28
                )
29
            );
30 1
            $counter++;
31 1
        } while ($counter <= $criteria->limit());
32 1
    }
33
}
34