Context::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
eloc 1
c 1
b 0
f 0
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
cc 1
nc 1
nop 1
crap 1
1
<?php
2
3
namespace Chain;
4
5
use ArrayObject;
6
7
class Context implements ContextInterface
8
{
9
    private ArrayObject $collection;
10
11 2
    public function __construct()
12
    {
13 2
        $this->collection = new ArrayObject();
14 2
    }
15
16 2
    public function get(string $key)
17
    {
18 2
        return $this->has($key) ? $this->collection->offsetGet($key) : null;
19
    }
20
21 2
    public function set(string $key, $value): void
22
    {
23 2
        $this->collection->offsetSet($key, $value);
24 2
    }
25
26 2
    public function has(string $key): bool
27
    {
28 2
        return $this->collection->offsetExists($key);
29
    }
30
}