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

CrosswordGenerator   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Test Coverage

Coverage 75%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 12
dl 0
loc 22
ccs 9
cts 12
cp 0.75
rs 10
c 1
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A generate() 0 13 2
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