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   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 90%

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 1
dl 0
loc 30
ccs 9
cts 10
cp 0.9
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A create() 0 8 1
A annotations() 0 12 3
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