ContainerConfig   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Test Coverage

Coverage 75%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 5
eloc 8
c 1
b 0
f 0
dl 0
loc 41
ccs 9
cts 12
cp 0.75
rs 10

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