ParamCollection   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A set() 0 3 1
A __construct() 0 3 1
A has() 0 3 1
A get() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Antidot\Container;
6
7
class ParamCollection
8
{
9
    /** @var array<mixed> */
10
    private array $parameters;
11
12
    /**
13
     * @param array<mixed> $parameters
14
     */
15 21
    public function __construct(array $parameters)
16
    {
17 21
        $this->parameters = $parameters;
18 21
    }
19
20
    /**
21
     * @param mixed $parameters
22
     */
23 13
    public function set(string $id, $parameters): void
24
    {
25 13
        $this->parameters[$id] = $parameters;
26 13
    }
27
28
    /**
29
     * @param int|string $id
30
     * @return bool
31
     */
32 13
    public function has($id): bool
33
    {
34 13
        return array_key_exists($id, $this->parameters);
35
    }
36
37
    /**
38
     * @return mixed
39
     */
40 8
    public function get(string $id)
41
    {
42 8
        return $this->parameters[$id];
43
    }
44
}
45