Completed
Push — master ( cbe0c9...b4ca26 )
by James Ekow Abaka
01:21
created

Bindings::setActiveKey()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 1
crap 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 5
        $this->activeKey = $activeKey;
12 5
        return $this;
13
    }
14
15 5
    public function to($value) {
16 5
        $this->bindings[$this->activeKey] = ['binding' => $value];
17 5
        return $this;
18
    }
19
20 5
    public function get($key) {
21 5
        return $this->bindings[$key];
22
    }
23
24 7
    public function has($key) {
25 7
        return isset($this->bindings[$key]);
26
    }
27
    
28
    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