| Conditions | 2 |
| Paths | 2 |
| Total Lines | 23 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 13 |
| CRAP Score | 2 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 18 | 3 | public function execute($request) |
|
| 19 | { |
||
| 20 | 3 | $this->throwExceptionIfRequestNotValid(__METHOD__, CreateEntityRequest::class, $request); |
|
| 21 | |||
| 22 | 2 | $name = $request->name; |
|
| 23 | 2 | $properties = $request->properties; |
|
| 24 | |||
| 25 | 2 | $entity = new EntityBuilder([ |
|
| 26 | 2 | 'name' => $name, |
|
| 27 | 2 | 'properties' => $properties, |
|
| 28 | ]); |
||
| 29 | |||
| 30 | 2 | $dir = sprintf('%1$s/../../tmp/skeleton/src/Domain/%2$s/Entity', __DIR__, $name); |
|
| 31 | |||
| 32 | 2 | if (!\is_dir($dir)) { |
|
| 33 | 2 | mkdir($dir, 0777, true); |
|
| 34 | } |
||
| 35 | |||
| 36 | 2 | $file = \sprintf('%1$s/%2$s.php', $dir, $name); |
|
| 37 | |||
| 38 | 2 | \file_put_contents($file, $entity->build()); |
|
| 39 | |||
| 40 | 2 | return new CreateEntityResponse($file); |
|
| 41 | } |
||
| 43 |