1 | <?php |
||
10 | class Factory |
||
11 | { |
||
12 | /** |
||
13 | * @var ContainerInterface |
||
14 | */ |
||
15 | protected static $container; |
||
16 | /** |
||
17 | * @var string |
||
18 | */ |
||
19 | protected $for; |
||
20 | /** |
||
21 | * @var string |
||
22 | */ |
||
23 | protected $prefix = ''; |
||
24 | /** |
||
25 | * @var array |
||
26 | */ |
||
27 | private $vars = []; |
||
28 | |||
29 | /** |
||
30 | * @param string $class |
||
31 | * @return Factory |
||
32 | */ |
||
33 | public static function for (string $class) : Factory |
||
39 | |||
40 | /** |
||
41 | * @param ContainerInterface $c |
||
42 | */ |
||
43 | public static function container(ContainerInterface $c) |
||
47 | |||
48 | /** |
||
49 | * @param string $prefix |
||
50 | * @return Factory |
||
51 | */ |
||
52 | public static function prefix(string $prefix) : Factory |
||
58 | |||
59 | /** |
||
60 | * @param string|null $class |
||
61 | * @return InstanceInterface |
||
62 | * @throws FactoryFailureException |
||
63 | */ |
||
64 | public function make(string $class = null) : InstanceInterface |
||
87 | |||
88 | /** |
||
89 | * @param string $for |
||
90 | */ |
||
91 | private function setFromContainer(string $for) |
||
116 | |||
117 | /** |
||
118 | * @param $implementation |
||
119 | * @return bool |
||
120 | */ |
||
121 | private function classInstantiateable($implementation) : bool |
||
130 | |||
131 | /** |
||
132 | * @param string $class |
||
133 | */ |
||
134 | private function guessInstantiation(string $class) |
||
147 | |||
148 | /** |
||
149 | * @param $key |
||
150 | * @param $value |
||
151 | * @return Factory |
||
152 | */ |
||
153 | public function with($key, $value) : Factory |
||
158 | |||
159 | /** |
||
160 | * @return array |
||
161 | */ |
||
162 | public function getVars() : array |
||
166 | |||
167 | /** |
||
168 | * @return string |
||
169 | */ |
||
170 | public function getFor() : string |
||
174 | |||
175 | /** |
||
176 | * @param string $for |
||
177 | * @return Factory |
||
178 | */ |
||
179 | public function as (string $for) : Factory |
||
184 | } |
||
185 |