Passed
Push — master ( 68213e...d07337 )
by Mike
02:37
created

AbstractDependencyProvider   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Test Coverage

Coverage 33.33%

Importance

Changes 0
Metric Value
wmc 4
eloc 6
dl 0
loc 42
ccs 3
cts 9
cp 0.3333
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A offsetSet() 0 3 1
A offsetExists() 0 3 1
A offsetUnset() 0 3 1
A offsetGet() 0 3 1
1
<?php
2
3
4
namespace Xervice\Core\Dependency;
5
6
7
abstract class AbstractDependencyProvider implements DependencyProviderInterface
8
{
9
    /**
10
     * @var callable[]
11
     */
12
    protected $container;
13
14
    /**
15
     * @param mixed $offset
16
     *
17
     * @return bool
18
     */
19
    public function offsetExists($offset): bool
20
    {
21
        return isset($this->container[$offset]);
22
    }
23
24
    /**
25
     * @param mixed $offset
26
     *
27
     * @return callable
28
     */
29
    public function offsetGet($offset)
30
    {
31
        return $this->container[$offset];
32
    }
33
34
    /**
35
     * @param mixed $offset
36
     * @param mixed $value
37
     */
38 1
    public function offsetSet($offset, $value)
39
    {
40 1
        $this->set($offset, $value);
41 1
    }
42
43
    /**
44
     * @param mixed $offset
45
     */
46
    public function offsetUnset($offset)
47
    {
48
        unset($this->container[$offset]);
49
    }
50
51
}