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 ( f252bb...862be0 )
by Sergey
10:05
created

Matcher   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 6
c 1
b 0
f 1
lcom 1
cbo 1
dl 0
loc 47
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
B toArray() 0 18 5
A getMediaType() 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\Annotations;
13
14
use Doctrine\Common\Annotations\Annotation\Target;
15
16
/**
17
 * JSON API code matcher annotation
18
 *
19
 * @package Reva2\JsonApi\Annotations
20
 * @author Sergey Revenko <[email protected]>
21
 *
22
 * @Annotation
23
 * @Target({"ANNOTATION"})
24
 */
25
class Matcher
26
{
27
    /**
28
     * Request decoders
29
     *
30
     * @var array<Reva2\JsonApi\Annotations\Decoder>
31
     */
32
    public $decoders;
33
34
    /**
35
     * Response encoders
36
     *
37
     * @var array<Reva2\JsonApi\Annotations\Encoder>
38
     */
39
    public $encoders;
40
41
    /**
42
     * @return array
43
     */
44
    public function toArray()
45
    {
46
        $data = ['encoders' => [], 'decoders' => []];
47
48
        if (null !== $this->decoders) {
49
            foreach ($this->decoders as $decoder) {
50
                $data['decoders'][$this->getMediaType($decoder)] = $decoder->decoder;
51
            }
52
        }
53
54
        if (null !== $this->encoders) {
55
            foreach ($this->encoders as $encoder) {
56
                $data['encoders'][$this->getMediaType($encoder)] = $encoder->encoder;
57
            }
58
        }
59
60
        return $data;
61
    }
62
63
    /**
64
     * @param MediaType $mediaType
65
     * @return string
66
     */
67
    private function getMediaType(MediaType $mediaType)
68
    {
69
        return $mediaType->type . '/' . $mediaType->subtype;
70
    }
71
}