Plugin::setApiId()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 5
ccs 3
cts 3
cp 1
crap 1
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace CCT\Kong\Model;
6
7
class Plugin
8
{
9
    /**
10
     * @var string
11
     */
12
    protected $id;
13
14
    /**
15
     * @var string
16
     */
17
    protected $apiId;
18
19
    /**
20
     * [Optional]
21
     * The unique identifier of the consumer that overrides the existing settings
22
     * for this specific consumer on incoming requests.
23
     *
24
     * @var string
25
     */
26
    protected $consumerId;
27
28
    /**
29
     * The name of the Plugin that's going to be added.
30
     *
31
     * @var string
32
     */
33
    protected $name;
34
35
    /**
36
     * The configuration properties for the Plugin.
37
     * The config must be prefixed with "config."
38
     *
39
     * @var array
40
     */
41
    protected $config = [];
42
43
    /**
44
     * @var bool
45
     */
46
    protected $enabled = true;
47
48
    /**
49
     * @var \DateTime
50
     */
51
    protected $createdAt;
52
53
    /**
54
     * Gets the id.
55
     *
56
     * @return string
57
     */
58 3
    public function getId(): ?string
59
    {
60 3
        return $this->id;
61
    }
62
63
    /**
64
     * @return string
65
     */
66 6
    public function getApiId(): ?string
67
    {
68 6
        return $this->apiId;
69
    }
70
71
    /**
72
     * @param string $apiId
73
     *
74
     * @return static
75
     */
76 3
    public function setApiId(string $apiId): self
77
    {
78 3
        $this->apiId = $apiId;
79
80 3
        return $this;
81
    }
82
83
    /**
84
     * @return string
85
     */
86 1
    public function getConsumerId(): string
87
    {
88 1
        return $this->consumerId;
89
    }
90
91
    /**
92
     * @param string $consumerId
93
     *
94
     * @return static
95
     */
96 1
    public function setConsumerId(string $consumerId): self
97
    {
98 1
        $this->consumerId = $consumerId;
99
100 1
        return $this;
101
    }
102
103
    /**
104
     * @return string
105
     */
106 1
    public function getName(): string
107
    {
108 1
        return $this->name;
109
    }
110
111
    /**
112
     * @param string $name
113
     *
114
     * @return static
115
     */
116 1
    public function setName(string $name): self
117
    {
118 1
        $this->name = $name;
119
120 1
        return $this;
121
    }
122
123
    /**
124
     * @return array
125
     */
126 1
    public function getConfig(): array
127
    {
128 1
        return $this->config;
129
    }
130
131
    /**
132
     * @param array $config
133
     *
134
     * @return static
135
     */
136 2
    public function setConfig(array $config): self
137
    {
138 2
        $this->config = $config;
139
140 2
        return $this;
141
    }
142
143
    public function replaceConfig(array $conf): self
144
    {
145
        $this->config = array_replace_recursive($this->config, $conf);
146
147
        return $this;
148
    }
149
150
    /**
151
     * @return bool
152
     */
153 1
    public function isEnabled(): bool
154
    {
155 1
        return $this->enabled;
156
    }
157
158
    /**
159
     * @param bool $enabled
160
     *
161
     * @return static
162
     */
163 3
    public function setEnabled(bool $enabled): self
164
    {
165 3
        $this->enabled = $enabled;
166
167 3
        return $this;
168
    }
169
170
    /**
171
     * @return \DateTime
172
     */
173 1
    public function getCreatedAt(): ?\DateTime
174
    {
175 1
        return $this->createdAt;
176
    }
177
}
178