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.

ClassMetadata::unserialize()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
c 1
b 1
f 0
dl 0
loc 10
rs 9.4285
cc 1
eloc 7
nc 1
nop 1
1
<?php
2
3
namespace Hateoas\Configuration\Metadata;
4
5
use Hateoas\Configuration\Relation;
6
use Hateoas\Configuration\RelationProvider;
7
use Metadata\MergeableClassMetadata;
8
use Metadata\MergeableInterface;
9
10
/**
11
 * @author Adrien Brault <[email protected]>
12
 */
13
class ClassMetadata extends MergeableClassMetadata implements ClassMetadataInterface
14
{
15
    /**
16
     * @var Relation[]
17
     */
18
    private $relations = array();
19
20
    /**
21
     * @var RelationProvider[]
22
     */
23
    private $relationProviders = array();
24
25
    /**
26
     * {@inheritDoc}
27
     */
28
    public function getName()
29
    {
30
        return $this->name;
31
    }
32
33
    /**
34
     * {@inheritDoc}
35
     */
36
    public function getRelations()
37
    {
38
        return $this->relations;
39
    }
40
41
    /**
42
     * {@inheritDoc}
43
     */
44
    public function getRelationProviders()
45
    {
46
        return $this->relationProviders;
47
    }
48
49
    /**
50
     * {@inheritDoc}
51
     */
52
    public function addRelation(Relation $relation)
53
    {
54
        $this->relations[] = $relation;
55
    }
56
57
    /**
58
     * {@inheritDoc}
59
     */
60
    public function addRelationProvider(RelationProvider $relationProvider)
61
    {
62
        $this->relationProviders[] = $relationProvider;
63
    }
64
65
    /**
66
     * {@inheritDoc}
67
     */
68
    public function merge(MergeableInterface $object)
69
    {
70
        if (!$object instanceof self) {
71
            throw new \InvalidArgumentException(sprintf('Object must be an instance of %s.', __CLASS__));
72
        }
73
74
        parent::merge($object);
75
76
        $this->relations         = array_merge($this->relations, $object->getRelations());
77
        $this->relationProviders = array_merge($this->relationProviders, $object->getRelationProviders());
78
    }
79
80
    /**
81
     * {@inheritDoc}
82
     */
83
    public function serialize()
84
    {
85
        return serialize(array(
86
            $this->relations,
87
            $this->relationProviders,
88
            parent::serialize(),
89
        ));
90
    }
91
92
    /**
93
     * {@inheritDoc}
94
     */
95
    public function unserialize($str)
96
    {
97
        list(
98
            $this->relations,
99
            $this->relationProviders,
100
            $parentStr
101
        ) = unserialize($str);
102
103
        parent::unserialize($parentStr);
104
    }
105
}
106