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 ( f8863b...48fd44 )
by Sergey
04:48
created

JsonApiRegistry   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 60
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 2
Metric Value
c 2
b 0
f 2
dl 0
loc 60
wmc 6
lcom 2
cbo 0
ccs 14
cts 14
cp 1
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A registerDecoder() 0 6 1
A getDecoder() 0 8 2
A registerEncoder() 0 6 1
A getEncoder() 0 8 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\Services;
13
14
use Reva2\JsonApi\Contracts\Services\JsonApiRegistryInterface;
15
16
/**
17
 * JSON API decoders/encoders registry
18
 *
19
 * @package Reva2\JsonApi\Services
20
 * @author Sergey Revenko <[email protected]>
21
 */
22
class JsonApiRegistry implements JsonApiRegistryInterface
23
{
24
    /**
25
     * Decoders map
26
     *
27
     * @var array
28
     */
29
    protected $decoders = [];
30
31
    /**
32
     * Encoders map
33
     *
34
     * @var array
35
     */
36
    protected $encoders = [];
37
38
    /**
39
     * @inheritdoc
40
     */
41 1
    public function registerDecoder($name, \Closure $decoder)
42
    {
43 1
        $this->decoders[$name] = $decoder;
44
45 1
        return $this;
46
    }
47
48
    /**
49
     * @inheritdoc
50
     */
51 2
    public function getDecoder($name)
52
    {
53 2
        if (!array_key_exists($name, $this->decoders)) {
54 1
            throw new \RuntimeException(sprintf("Decoder with name '%s' is not registered", $name));
55
        }
56
57 1
        return $this->decoders[$name];
58
    }
59
60
    /**
61
     * @inheritdoc
62
     */
63 1
    public function registerEncoder($name, \Closure $encoder)
64
    {
65 1
        $this->encoders[$name] = $encoder;
66
67 1
        return $this;
68
    }
69
70
    /**
71
     * @inheritdoc
72
     */
73 2
    public function getEncoder($name)
74
    {
75 2
        if (!array_key_exists($name, $this->encoders)) {
76 1
            throw new \RuntimeException(sprintf("Encoder with name '%s' is not registered", $name));
77
        }
78
79 1
        return $this->encoders[$name];
80
    }
81
}
82