1 | <?php |
||
31 | trait FactoryTrait |
||
32 | { |
||
33 | /** |
||
34 | * @var Container |
||
35 | * @access protected |
||
36 | */ |
||
37 | protected $master; |
||
38 | |||
39 | /** |
||
40 | * Get service definition (and fix it) |
||
41 | * |
||
42 | * @param string $rawId |
||
43 | * @param array $args |
||
44 | * @return array |
||
45 | * @access protected |
||
46 | */ |
||
47 | protected function getDefinition( |
||
67 | |||
68 | /** |
||
69 | * Instantiate service object from classname |
||
70 | * |
||
71 | * @param string $class |
||
72 | * @param array $args |
||
73 | * @return object |
||
74 | * @throws LogicException if something goes wrong |
||
75 | * @access protected |
||
76 | */ |
||
77 | protected function constructObject(/*# string */ $class, array $args) |
||
97 | |||
98 | /** |
||
99 | * Match provided arguments with a method/function's reflection parameters |
||
100 | * |
||
101 | * @param \ReflectionParameter[] $reflectionParameters |
||
102 | * @param array $providedArguments |
||
103 | * @return array the resolved arguments |
||
104 | * @throws LogicException |
||
105 | * @throws NotFoundException |
||
106 | * @access protected |
||
107 | */ |
||
108 | protected function matchArguments( |
||
135 | |||
136 | /** |
||
137 | * Is $parameter same type as the $argument ? |
||
138 | * |
||
139 | * @param \ReflectionParameter $parameter |
||
140 | * @param mixed $argument |
||
141 | * @param null|string $class |
||
142 | * @return bool |
||
143 | * @access protected |
||
144 | */ |
||
145 | protected function isTypeMatched( |
||
158 | |||
159 | /** |
||
160 | * Get an object base on provided classname or interface name |
||
161 | * |
||
162 | * @param string $classname class or interface name |
||
163 | * @return object |
||
164 | * @throws \Exception if something goes wrong |
||
165 | * @access protected |
||
166 | */ |
||
167 | protected function getObjectByClass(/*# string */ $classname) |
||
178 | |||
179 | /** |
||
180 | * Get callable parameters |
||
181 | * |
||
182 | * @param callable $callable |
||
183 | * @return \ReflectionParameter[] |
||
184 | * @throws LogicException if something goes wrong |
||
185 | * @access protected |
||
186 | */ |
||
187 | protected function getCallableParameters(callable $callable)/*# : array */ |
||
206 | |||
207 | /** |
||
208 | * Is $var an object with '__invoke()' defined ? |
||
209 | * |
||
210 | * @param mixed $var |
||
211 | * @return bool |
||
212 | * @access protected |
||
213 | */ |
||
214 | protected function isInvocable($var)/*# : bool */ |
||
218 | |||
219 | /** |
||
220 | * Merge different sections of a node |
||
221 | * |
||
222 | * convert |
||
223 | * `['section1' => [[1], [2]], 'section2' => [[3], [4]]]` |
||
224 | * |
||
225 | * to |
||
226 | * `[[1], [2], [3], [4]]` |
||
227 | * |
||
228 | * @param array $nodeData |
||
229 | * @return array |
||
230 | * @access protected |
||
231 | */ |
||
232 | protected function mergeMethods(array $nodeData)/*# : array */ |
||
246 | |||
247 | /** |
||
248 | * Execute common methods defined in 'di.common' for all objects |
||
249 | * |
||
250 | * @param object $object |
||
251 | * @return $this |
||
252 | * @access protected |
||
253 | */ |
||
254 | protected function executeCommonBatch($object) |
||
272 | } |
||
273 |