ParameterBag   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 10
c 1
b 0
f 0
dl 0
loc 36
ccs 15
cts 15
cp 1
rs 10
wmc 6

6 Methods

Rating   Name   Duplication   Size   Complexity  
A remove() 0 5 1
A __construct() 0 3 1
A has() 0 3 1
A all() 0 3 1
A get() 0 3 1
A set() 0 5 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Suitcase\Builder;
6
7
final class ParameterBag
8
{
9
    protected array $parameters;
10
11 62
    public function __construct(array $parameters = [])
12
    {
13 62
        $this->parameters = $parameters;
14 62
    }
15
16 2
    public function get(string $key):? string
17
    {
18 2
        return $this->parameters[$key] ?? null;
19
    }
20
21 6
    public function has(string $key): bool
22
    {
23 6
        return array_key_exists($key, $this->parameters);
24
    }
25
26 2
    public function set(string $key, string $value): self
27
    {
28 2
        $this->parameters[$key] = $value;
29
30 2
        return $this;
31
    }
32
33 2
    public function remove(string $key): self
34
    {
35 2
        unset($this->parameters[$key]);
36
37 2
        return $this;
38
    }
39
40 6
    public function all(): array
41
    {
42 6
        return $this->parameters;
43
    }
44
}
45