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 ( 0d846c...fab3df )
by Sergey
03:21
created

ClassMetadata   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 71
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 3
Bugs 0 Features 0
Metric Value
wmc 6
c 3
b 0
f 0
lcom 1
cbo 1
dl 0
loc 71
ccs 16
cts 16
cp 1
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getDiscriminatorField() 0 4 1
A setDiscriminatorField() 0 6 1
A setDiscriminatorMap() 0 6 1
A getDiscriminatorClass() 0 11 2
A mergeMetadata() 0 4 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\ClassMetadataInterface;
15
use Reva2\JsonApi\Contracts\Decoders\Mapping\PropertyMetadataInterface;
16
17
/**
18
 * Generic class metadata
19
 *
20
 * @package Reva2\JsonApi\Decoders\Mapping
21
 * @author Sergey Revenko <[email protected]>
22
 */
23
class ClassMetadata extends GenericMetadata implements ClassMetadataInterface
24
{
25
    /***
26
     * @var PropertyMetadataInterface|null
27
     * @internal
28
     */
29
    public $discField;
30
31
    /**
32
     * @var array
33
     * @internal
34
     */
35
    public $discMap;
36
37
    /**
38
     * @inheritdoc
39
     */
40 6
    public function getDiscriminatorField()
41
    {
42 6
        return $this->discField;
43
    }
44
45
    /**
46
     * Sets discriminator field
47
     *
48
     * @param PropertyMetadataInterface|null $field
49
     * @return $this
50
     */
51 8
    public function setDiscriminatorField(PropertyMetadataInterface $field = null)
52
    {
53 8
        $this->discField = $field;
54
55 8
        return $this;
56
    }
57
58
    /**
59
     * Sets discriminator map
60
     *
61
     * @param array $map
62
     * @return $this
63
     */
64 9
    public function setDiscriminatorMap(array $map)
65
    {
66 9
        $this->discMap = $map;
67
68 9
        return $this;
69
    }
70
71
    /**
72
     * @inheritdoc
73
     */
74 7
    public function getDiscriminatorClass($value)
75
    {
76 7
        if (!array_key_exists($value, $this->discMap)) {
77 1
            throw new \InvalidArgumentException(sprintf(
78 1
                "Discriminator class for value '%s' not specified",
79
                $value
80 1
            ));
81
        }
82
83 7
        return $this->discMap[$value];
84
    }
85
86
    /**
87
     * @inheritdoc
88
     */
89 1
    public function mergeMetadata($metadata)
90
    {
91
        // Nothing to do here
92 1
    }
93
}
94