ContainerConfig::set()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 3
rs 10
ccs 2
cts 2
cp 1
cc 1
nc 1
nop 2
crap 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