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.
Completed
Push — master ( 6776ef...c935c0 )
by Cees-Jan
07:09
created

Factory   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 28
wmc 4
lcom 0
cbo 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A create() 0 6 1
A annotations() 0 12 3
1
<?php declare(strict_types=1);
2
3
namespace ApiClients\Foundation\Hydrator;
4
5
use ApiClients\Foundation\Hydrator\Annotations;
6
7
class Factory
8
{
9
    const ANNOTATIONS = [
10
        Annotations\Collection::class => Annotations\Handler\CollectionHandler::class,
11
        Annotations\Nested::class => Annotations\Handler\NestedHandler::class,
12
        Annotations\Rename::class => Annotations\Handler\RenameHandler::class,
13
    ];
14
15
    public static function create(array $options = []): Hydrator
16
    {
17
        $options[Options::ANNOTATIONS] = static::annotations($options[Options::ANNOTATIONS] ?? []);
18
19
        return new Hydrator($options);
20
    }
21
22
    protected static function annotations(array $annotations): array
23
    {
24
        foreach (static::ANNOTATIONS as $annotation => $handler) {
25
            if (isset($annotations[$annotation])) {
26
                continue;
27
            }
28
29
            $annotations[$annotation] = $handler;
30
        }
31
32
        return $annotations;
33
    }
34
}
35