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 ( 78595b...b10bb2 )
by Sergey
06:33
created

ClassMetadata   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 71
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 73.32%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 6
c 2
b 0
f 0
lcom 1
cbo 1
dl 0
loc 71
ccs 11
cts 15
cp 0.7332
rs 10

5 Methods

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