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

NestedHandler   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 32
wmc 7
lcom 0
cbo 3
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A hydrate() 0 16 4
A extract() 0 12 3
1
<?php
2
declare(strict_types=1);
3
4
namespace ApiClients\Foundation\Hydrator\Annotations\Handler;
5
6
use ApiClients\Foundation\Hydrator\Annotations\Nested;
7
use ApiClients\Foundation\Hydrator\AnnotationInterface;
8
use ApiClients\Foundation\Hydrator\HandlerInterface;
9
use ApiClients\Foundation\Resource\ResourceInterface;
10
11
class NestedHandler extends AbstractHandler implements HandlerInterface
12
{
13
    public function hydrate(AnnotationInterface $annotation, array $json, ResourceInterface $object): array
14
    {
15
        if (!($annotation instanceof Nested)) {
16
            return $json;
17
        }
18
19
        foreach ($annotation->properties() as $property) {
20
            if ($json[$property] === null) {
21
                continue;
22
            }
23
24
            $json[$property] = $this->getHydrator()->hydrate($annotation->get($property), $json[$property]);
25
        }
26
27
        return $json;
28
    }
29
30
    public function extract(AnnotationInterface $annotation, ResourceInterface $object, array $json): array
31
    {
32
        if (!($annotation instanceof Nested)) {
33
            return $json;
34
        }
35
36
        foreach ($annotation->properties() as $property) {
37
            $json[$property] = $this->getHydrator()->extract($annotation->get($property), $json[$property]);
38
        }
39
40
        return $json;
41
    }
42
}
43