Completed
Push — master ( bee542...31e600 )
by James Ekow Abaka
01:58
created

Bindings   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 6
lcom 1
cbo 0
dl 0
loc 32
ccs 10
cts 10
cp 1
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A setActiveKey() 0 4 1
A to() 0 4 1
A get() 0 3 1
A has() 0 3 1
A asSingleton() 0 3 1
A remove() 0 3 1
1
<?php
2
3
namespace ntentan\panie;
4
5
class Bindings {
6
7
    private $bindings = [];
8
    private $activeKey;
9
10 5
    public function setActiveKey($activeKey) {
11
        $this->activeKey = $activeKey;
12 5
        return $this;
13 5
    }
14
15
    public function to($value) {
16 5
        $this->bindings[$this->activeKey] = ['class' => $value];
17
        return $this;
18 5
    }
19 5
20
    public function get($key) {
21 5
        return $this->bindings[$key];
22
    }
23 5
24
    public function has($key) {
25
        return isset($this->bindings[$key]);
26 7
    }
27
    
28 7
    public function asSingleton() {
29
        $this->bindings[$this->activeKey]['singleton'] = true;
30
    }
31
    
32
    public function remove($type) {
33
        unset($this->bindings[$type]);
34
    }
35
36
}
37