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 ( 643d67...78595b )
by Sergey
02:43
created

ObjectMetadata::addProperty()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 6
ccs 3
cts 3
cp 1
rs 9.4285
cc 1
eloc 3
nc 1
nop 1
crap 1
1
<?php
2
/*
3
 * This file is part of the reva2/jsonapi.
4
 *
5
 * (c) OrbitScripts LLC <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
12
namespace Reva2\JsonApi\Decoders\Mapping;
13
14
use Reva2\JsonApi\Contracts\Decoders\Mapping\ObjectMetadataInterface;
15
use Reva2\JsonApi\Contracts\Decoders\Mapping\PropertyMetadataInterface;
16
17
/**
18
 * ObjectMetadata
19
 *
20
 * @package Reva2\JsonApi\Decoders\Mapping
21
 * @author Sergey Revenko <[email protected]>
22
 */
23
class ObjectMetadata extends ClassMetadata implements ObjectMetadataInterface
24
{
25
    /**
26
     * @var PropertyMetadataInterface[]
27
     */
28
    public $properties = [];
29
30
    /**
31
     * Returns object properties metadata
32
     *
33
     * @return PropertyMetadataInterface[]
34
     */
35 1
    public function getProperties()
36
    {
37 1
        return $this->properties;
38
    }
39
40
    /**
41
     * Adds property metadata
42
     *
43
     * @param PropertyMetadataInterface $metadata
44
     * @return $this
45
     */
46 1
    public function addProperty(PropertyMetadataInterface $metadata)
47
    {
48 1
        $this->properties[$metadata->getPropertyName()] = $metadata;
49
50 1
        return $this;
51
    }
52
53
    /**
54
     * @inheritdoc
55
     */
56 1
    public function mergeMetadata($metadata = null)
57
    {
58 1
        if (null === $metadata) {
59
            if (!$metadata instanceof ObjectMetadataInterface) {
60
                /* @var $metadata \Reva2\JsonApi\Contracts\Decoders\Mapping\GenericMetadataInterface */
61
62
                throw new \RuntimeException(sprintf(
63
                    "Failed to merge metadata from parent class %s",
64
                    $metadata->getClassName()
65
                ));
66
            }
67
68
            $this->properties = array_merge($this->properties, $metadata->getProperties());
69
        }
70
71 1
        return $this;
72
    }
73
}