Context   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A has() 0 3 1
A set() 0 3 1
A get() 0 3 2
A __construct() 0 3 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
}