1 | <?php |
||
8 | class Bindings |
||
9 | { |
||
10 | |||
11 | /** |
||
12 | * An array of all the bindings. |
||
13 | * @var array |
||
14 | */ |
||
15 | private $bindings = []; |
||
16 | |||
17 | /** |
||
18 | * An active key that would be altered with subsequent calls to the bindings object. |
||
19 | * @var string |
||
20 | */ |
||
21 | private $activeKey; |
||
22 | |||
23 | 4 | public function setActiveKey($activeKey) |
|
28 | |||
29 | public function call($method, $parameters = []) |
||
30 | { |
||
31 | $this->bindings[$this->activeKey]['calls'][] = ['setter' => $method, 'parameters' => $parameters]; |
||
32 | } |
||
33 | |||
34 | public function setProperty($property, $binding) |
||
35 | { |
||
36 | $this->bindings[$this->activeKey]['sets'][] = ['property' => $property, 'binding' => $binding]; |
||
37 | } |
||
38 | |||
39 | 4 | public function to($value) |
|
40 | { |
||
41 | 4 | $this->bindings[$this->activeKey] = ['binding' => $value, 'calls'=>[], 'properties' => []]; |
|
42 | 4 | return $this; |
|
43 | } |
||
44 | |||
45 | 4 | public function get($key) |
|
46 | { |
||
47 | 4 | return $this->bindings[$key]; |
|
48 | } |
||
49 | |||
50 | 6 | public function has($key) |
|
51 | { |
||
52 | 6 | return isset($this->bindings[$key]); |
|
53 | } |
||
54 | |||
55 | public function merge($bindings, $replace = true) |
||
71 | |||
72 | } |
||
73 |