GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Factory::annotations()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 12

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 3.0416

Importance

Changes 0
Metric Value
dl 0
loc 12
ccs 5
cts 6
cp 0.8333
rs 9.8666
c 0
b 0
f 0
cc 3
nc 3
nop 1
crap 3.0416
1
<?php declare(strict_types=1);
2
3
namespace ApiClients\Foundation\Hydrator;
4
5
use ApiClients\Tools\CommandBus\CommandBusInterface;
6
use React\EventLoop\LoopInterface;
7
8
class Factory
9
{
10
    const ANNOTATIONS = [
11
        Annotation\Collection::class => Annotation\Handler\CollectionHandler::class,
12
        Annotation\Nested::class => Annotation\Handler\NestedHandler::class,
13
        Annotation\Rename::class => Annotation\Handler\RenameHandler::class,
14
    ];
15
16 9
    public static function create(LoopInterface $loop, CommandBusInterface $commandBus, array $options): Hydrator
17
    {
18 9
        $options[Options::ANNOTATIONS] = static::annotations($options[Options::ANNOTATIONS] ?? []);
19
20 9
        $hydrator = new Hydrator($loop, $commandBus, $options);
21
22 9
        return $hydrator;
23
    }
24
25 9
    protected static function annotations(array $annotations): array
26
    {
27 9
        foreach (static::ANNOTATIONS as $annotation => $handler) {
28 9
            if (isset($annotations[$annotation])) {
29
                continue;
30
            }
31
32 9
            $annotations[$annotation] = $handler;
33
        }
34
35 9
        return $annotations;
36
    }
37
}
38