1 | <?php |
||
30 | class Generator |
||
31 | { |
||
32 | const PROP_CONTAINER = '__container'; |
||
33 | const PROP_ORIGINAL = '__original'; |
||
34 | |||
35 | /** |
||
36 | * @var PhpGenerator |
||
37 | */ |
||
38 | protected $phpGenerator; |
||
39 | |||
40 | /** |
||
41 | * @param PhpGenerator $phpGenerator |
||
42 | */ |
||
43 | public function __construct(PhpGenerator $phpGenerator) |
||
47 | |||
48 | /** |
||
49 | * @param Mapping $mapping |
||
50 | * @param string $path |
||
51 | * |
||
52 | * @return string |
||
53 | */ |
||
54 | public function generate(Mapping $mapping, $path) |
||
77 | |||
78 | /** |
||
79 | * @param string $class |
||
80 | * |
||
81 | * @return \ReflectionClass |
||
82 | * |
||
83 | * @throws \Exception |
||
84 | */ |
||
85 | protected function getReflectionClass($class) |
||
93 | |||
94 | /** |
||
95 | * @return Property[] |
||
96 | */ |
||
97 | protected function generatePropertyNodes() |
||
112 | |||
113 | /** |
||
114 | * @param Mapping $mapping |
||
115 | * |
||
116 | * @return ClassMethod[] |
||
117 | */ |
||
118 | protected function generateMethodNodes(Mapping $mapping) |
||
134 | |||
135 | /** |
||
136 | * @return ClassMethod |
||
137 | */ |
||
138 | protected function generateMethodConstructNode() |
||
157 | |||
158 | /** |
||
159 | * @param Mapping $mapping |
||
160 | * @param \ReflectionMethod $reflectionMethod |
||
161 | * |
||
162 | * @return ClassMethod |
||
163 | */ |
||
164 | protected function generateMethodOriginalNode(Mapping $mapping, $reflectionMethod) |
||
192 | |||
193 | /** |
||
194 | * @param Mapping $mapping |
||
195 | * |
||
196 | * @return ConstructArgument[] |
||
197 | */ |
||
198 | protected function getConstructArgumentsByName(Mapping $mapping) |
||
207 | |||
208 | /** |
||
209 | * @param \ReflectionMethod $reflectionMethod |
||
210 | * @param ConstructArgument[] $constructArgumentsByName |
||
211 | * |
||
212 | * @return Arg[] |
||
213 | */ |
||
214 | protected function generateOriginalArgumentNodes(\ReflectionMethod $reflectionMethod, array $constructArgumentsByName) |
||
234 | |||
235 | /** |
||
236 | * @param \ReflectionMethod $reflectionMethod |
||
237 | * |
||
238 | * @return ClassMethod |
||
239 | */ |
||
240 | protected function generateMethodNode(\ReflectionMethod $reflectionMethod) |
||
256 | |||
257 | /** |
||
258 | * @param \ReflectionMethod $reflectionMethod |
||
259 | * |
||
260 | * @return Expr[] |
||
261 | */ |
||
262 | protected function generateParameterNodes(\ReflectionMethod $reflectionMethod) |
||
271 | |||
272 | /** |
||
273 | * @param \ReflectionMethod $reflectionMethod |
||
274 | * |
||
275 | * @return Arg[] |
||
276 | */ |
||
277 | protected function generateArgumentNodes(\ReflectionMethod $reflectionMethod) |
||
286 | |||
287 | /** |
||
288 | * @param \ReflectionParameter $reflectionParameter |
||
289 | * |
||
290 | * @return Param |
||
291 | */ |
||
292 | protected function generateParameterNode(\ReflectionParameter $reflectionParameter) |
||
302 | |||
303 | /** |
||
304 | * @param \ReflectionParameter $reflectionParameter |
||
305 | * |
||
306 | * @return null|Expr |
||
307 | */ |
||
308 | protected function getParameterDefault(\ReflectionParameter $reflectionParameter) |
||
318 | |||
319 | /** |
||
320 | * @param \ReflectionParameter $reflectionParameter |
||
321 | * |
||
322 | * @return null|string |
||
323 | */ |
||
324 | protected function getParameterTypeHint(\ReflectionParameter $reflectionParameter) |
||
334 | |||
335 | /** |
||
336 | * @param \ReflectionParameter $reflectionParameter |
||
337 | * |
||
338 | * @return bool |
||
339 | */ |
||
340 | protected function isParameterVariadic(\ReflectionParameter $reflectionParameter) |
||
349 | |||
350 | /** |
||
351 | * @param mixed $value |
||
352 | * |
||
353 | * @return Expr |
||
354 | */ |
||
355 | protected function prepareStatement($value) |
||
364 | |||
365 | /** |
||
366 | * @param array $value |
||
367 | * |
||
368 | * @return Array_ |
||
369 | */ |
||
370 | protected function prepareStatmentForArray($value) |
||
379 | |||
380 | /** |
||
381 | * @return ConstFetch |
||
382 | */ |
||
383 | protected function prepareStatmentForNull() |
||
387 | |||
388 | /** |
||
389 | * @param bool $value |
||
390 | * |
||
391 | * @return ConstFetch |
||
392 | */ |
||
393 | protected function prepareStatmentForBool($value) |
||
397 | |||
398 | /** |
||
399 | * @param int $value |
||
400 | * |
||
401 | * @return LNumber |
||
402 | */ |
||
403 | protected function prepareStatmentForInt($value) |
||
407 | |||
408 | /** |
||
409 | * @param float $value |
||
410 | * |
||
411 | * @return DNumber |
||
412 | */ |
||
413 | protected function prepareStatmentForFloat($value) |
||
417 | |||
418 | /** |
||
419 | * @param string $value |
||
420 | * |
||
421 | * @return String_ |
||
422 | */ |
||
423 | protected function prepareStatmentForString($value) |
||
427 | } |
||
428 |