ParamCollection::has()   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 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 1
b 0
f 0
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