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
Pull Request — master (#2)
by VEBER
01:56
created

Plugin   A

Complexity

Total Complexity 10

Size/Duplication

Total Lines 129
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 10
lcom 1
cbo 1
dl 0
loc 129
rs 10
c 0
b 0
f 0

8 Methods

Rating   Name   Duplication   Size   Complexity  
A setName() 0 6 1
A getName() 0 4 1
A setConsumerId() 0 6 1
A getConsumerId() 0 4 1
A addConfig() 0 10 2
A removeConfig() 0 8 2
A getConfig() 0 4 1
A getFields() 0 8 1
1
<?php
2
3
/*
4
 * This file is part of the KongAdminApi package.
5
 *
6
 * (c) Unikorp <https://github.com/unikorp>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Unikorp\KongAdminApi\Document;
13
14
use Unikorp\KongAdminApi\AbstractDocument;
15
16
/**
17
 * plugin
18
 *
19
 * @author VEBER Arnaud <https://github.com/VEBERArnaud>
20
 */
21
class Plugin extends AbstractDocument
22
{
23
    /**
24
     * name
25
     * @var string $name
26
     */
27
    private $name = null;
28
29
    /**
30
     * consumer id
31
     * @var string $consumerId
32
     */
33
    private $consumerId = null;
34
35
    /**
36
     * config
37
     * @var array $config
38
     */
39
    private $config = [];
40
41
    /**
42
     * set name
43
     *
44
     * @param string $name
45
     *
46
     * @return this
47
     */
48
    public function setName($name)
49
    {
50
        $this->name = $name;
51
52
        return $this;
53
    }
54
55
    /**
56
     * get name
57
     *
58
     * @return string
59
     */
60
    public function getName()
61
    {
62
        return $this->name;
63
    }
64
65
    /**
66
     * set consumer id
67
     *
68
     * @param string $consumerId
69
     *
70
     * @return this
71
     */
72
    public function setConsumerId($consumerId)
73
    {
74
        $this->consumerId = $consumerId;
75
76
        return $this;
77
    }
78
79
    /**
80
     * get consumer id
81
     *
82
     * @return string
83
     */
84
    public function getConsumerId()
85
    {
86
        return $this->consumerId;
87
    }
88
89
    /**
90
     * add config
91
     *
92
     * @param string $name
93
     * @param mixed $value
94
     *
95
     * @return this
96
     */
97
    public function addConfig($name, $value)
98
    {
99
        if (isset($this->config[$name])) {
100
            throw new \RuntimeException();
101
        }
102
103
        $this->config[$name] = $value;
104
105
        return $this;
106
    }
107
108
    /**
109
     * remove config
110
     *
111
     * @param string $name
112
     *
113
     * @return this
114
     */
115
    public function removeConfig($name)
116
    {
117
        if (isset($this->config[$name])) {
118
            unset($this->config[$name]);
119
        }
120
121
        return $this;
122
    }
123
124
    /**
125
     * get config
126
     *
127
     * @param string $name
128
     *
129
     * @return mixed
130
     */
131
    public function getConfig($name)
132
    {
133
        return $this->config[$name];
134
    }
135
136
    /**
137
     * get fields
138
     *
139
     * @return array
140
     */
141
    protected function getFields()
142
    {
143
        return [
144
            'name',
145
            'consumerId',
146
            'config',
147
        ];
148
    }
149
}
150