Zone   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 6
eloc 11
c 2
b 0
f 0
dl 0
loc 32
ccs 14
cts 14
cp 1
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A replace() 0 3 1
A __construct() 0 3 1
A jsonSerialize() 0 8 2
A get() 0 7 2
1
<?php
2
3
namespace Sebdesign\ArtisanCloudflare;
4
5
use JsonSerializable;
6
7
class Zone implements JsonSerializable
8
{
9
    /** @var array */
10
    private $parameters;
11
12 69
    public function __construct(array $parameters = [])
13
    {
14 69
        $this->parameters = $parameters;
15 69
    }
16
17 36
    public function replace(array $parameters): void
18
    {
19 36
        $this->parameters = $parameters;
20 36
    }
21
22
    #[\ReturnTypeWillChange]
23 63
    public function jsonSerialize(): array
24
    {
25 63
        if (empty($this->parameters)) {
26 15
            return ['purge_everything' => true];
27
        }
28
29 57
        return $this->parameters;
30
    }
31
32 51
    public function get($key, $default = null)
33
    {
34 51
        if (isset($this->parameters[$key])) {
35 51
            return $this->parameters[$key];
36
        }
37
38 24
        return $default;
39
    }
40
}
41