| Conditions | 1 |
| Paths | 1 |
| Total Lines | 16 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 14 |
| CRAP Score | 1 |
| Changes | 0 | ||
| 1 | <?php declare(strict_types=1); |
||
| 28 | 8 | public function setEntityHasEmbeddable(string $entityFqn, string $embeddableTraitFqn) |
|
| 29 | { |
||
| 30 | 8 | $entityReflection = new \ReflectionClass($entityFqn); |
|
| 31 | 8 | $entity = PhpClass::fromFile($entityReflection->getFileName()); |
|
| 32 | 8 | $embeddableReflection = new \ReflectionClass($embeddableTraitFqn); |
|
| 33 | 8 | $trait = PhpTrait::fromFile($embeddableReflection->getFileName()); |
|
| 34 | 8 | $interfaceFqn = \str_replace( |
|
| 35 | 8 | 'Trait', |
|
| 36 | 8 | 'Interface', |
|
| 37 | 8 | $embeddableTraitFqn |
|
| 38 | ); |
||
| 39 | 8 | $interfaceReflection = new \ReflectionClass($interfaceFqn); |
|
| 40 | 8 | $interface = PhpInterface::fromFile($interfaceReflection->getFileName()); |
|
| 41 | 8 | $entity->addTrait($trait) |
|
| 42 | 8 | ->addInterface($interface); |
|
| 43 | 8 | $this->codeHelper->generate($entity, $entityReflection->getFileName()); |
|
| 44 | 8 | } |
|
| 46 |