| Conditions | 2 |
| Paths | 2 |
| Total Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 32 | public function generate(ReflectionClass $originalClass) : array |
||
| 33 | { |
||
| 34 | $ast = [new Class_($originalClass->getShortName())]; |
||
| 35 | |||
| 36 | $namespace = $originalClass->getNamespaceName(); |
||
| 37 | if ($namespace) { |
||
| 38 | $ast = [new Namespace_(new Name(explode('\\', $namespace)), $ast)]; |
||
| 39 | } |
||
| 40 | |||
| 41 | $implementor = new NodeTraverser(); |
||
| 42 | $implementor->addVisitor(new HydratorMethodsVisitor($originalClass)); |
||
| 43 | $implementor->addVisitor(new ClassImplementorVisitor($originalClass->getName(), [HydratorInterface::class])); |
||
|
|
|||
| 44 | |||
| 45 | return $implementor->traverse($ast); |
||
| 46 | } |
||
| 47 | } |
||
| 48 |