CrosswordReceiver::receive()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
eloc 5
nc 2
nop 1
dl 0
loc 9
ccs 5
cts 5
cp 1
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace App\Crossword\Features\Receiver;
6
7
use Psr\Log\LoggerInterface;
0 ignored issues
show
Bug introduced by
The type Psr\Log\LoggerInterface 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...
8
use Throwable;
9
10
final class CrosswordReceiver
11
{
12
    private LoggerInterface $logger;
13
    private ReadCrosswordRepositoryInterface $readCrosswordRepository;
14
15
    public function __construct(ReadCrosswordRepositoryInterface $readCrosswordRepository, LoggerInterface $logger)
16
    {
17
        $this->logger = $logger;
18
        $this->readCrosswordRepository = $readCrosswordRepository;
19
    }
20
21
    /**
22
     * @throws ReceiveCrosswordException
23
     */
24 2
    public function receive(string $key): array
25
    {
26
        try {
27 2
            return $this->readCrosswordRepository->get($key);
28 1
        } catch (Throwable $exception) {
29 1
            $this->logger->error($exception->getMessage());
30
        }
31
32 1
        throw new ReceiveCrosswordException();
33
    }
34
}
35