1 | <?php |
||
9 | trait TInjectable |
||
10 | { |
||
11 | |||
12 | /** |
||
13 | * Properties |
||
14 | */ |
||
15 | protected $di; // the service container |
||
16 | |||
17 | |||
18 | |||
19 | /** |
||
20 | * Set the service container to use |
||
21 | * |
||
22 | * @param class $di a service container |
||
23 | * |
||
24 | * @return $this |
||
25 | */ |
||
26 | public function setDI($di) |
||
30 | |||
31 | |||
32 | |||
33 | /** |
||
34 | * Magic method to get and create services. |
||
35 | * When created it is also stored as a parameter of this object. |
||
36 | * |
||
37 | * @param string $service name of class property not existing. |
||
38 | * |
||
39 | * @return class as the service requested. |
||
40 | */ |
||
41 | public function __get($service) |
||
64 | |||
65 | |||
66 | |||
67 | /** |
||
68 | * Magic method to get and create services as a method call. |
||
69 | * When created it is also stored as a parameter of this object. |
||
70 | * |
||
71 | * @param string $service name of class property not existing. |
||
72 | * @param array $arguments Additional arguments to sen to the method (NOT IMPLEMENTED). |
||
73 | * |
||
74 | * @return class as the service requested. |
||
75 | */ |
||
76 | public function __call($service, $arguments = []) |
||
98 | } |
||
99 |