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 ( 0f07bb...d93f36 )
by Sergey
05:25
created

Matcher::getMediaType()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
c 0
b 0
f 0
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 1
crap 1
1
<?php
2
/*
3
 * This file is part of the reva2/jsonapi.
4
 *
5
 * (c) Sergey Revenko <[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
/**
15
 * JSON API code matcher annotation
16
 *
17
 * @package Reva2\JsonApi\Annotations
18
 * @author Sergey Revenko <[email protected]>
19
 *
20
 * @Annotation
21
 * @Target({"ANNOTATION"})
22
 */
23
class Matcher
24
{
25
    /**
26
     * Request decoders
27
     *
28
     * @var array<Reva2\JsonApi\Annotations\Decoder>
29
     */
30
    public $decoders;
31
32
    /**
33
     * Response encoders
34
     *
35
     * @var array<Reva2\JsonApi\Annotations\Encoder>
36
     */
37
    public $encoders;
38
39
    /**
40
     * @return array
41
     */
42 1
    public function toArray()
43
    {
44 1
        $data = ['encoders' => [], 'decoders' => []];
45
46 1
        if (null !== $this->decoders) {
47 1
            foreach ($this->decoders as $decoder) {
48 1
                $data['decoders'][$this->getMediaType($decoder)] = $decoder->decoder;
49 1
            }
50 1
        }
51
52 1
        if (null !== $this->encoders) {
53 1
            foreach ($this->encoders as $encoder) {
54 1
                $data['encoders'][$this->getMediaType($encoder)] = $encoder->encoder;
55 1
            }
56 1
        }
57
58 1
        return $data;
59
    }
60
61
    /**
62
     * @param MediaType $mediaType
63
     * @return string
64
     */
65 1
    private function getMediaType(MediaType $mediaType)
66
    {
67 1
        return $mediaType->type . '/' . $mediaType->subtype;
68
    }
69
}
70