Total Complexity | 3 |
Total Lines | 24 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php declare(strict_types=1); |
||
16 | 1 | final class CommandBuilder extends AbstractBuilder |
|
17 | { |
||
18 | public function __construct(SchemaInterface $schema, string $action) |
||
19 | { |
||
20 | $entity = $this->getInflector()->entity($schema->name()); |
||
21 | $action = $this->getInflector()->pascalAction($action); |
||
22 | $command = $this->getInflector()->commandName($entity, $action); |
||
23 | $properties = \array_reduce($schema->attributes(), function ($result, SchemaAttributeInterface $property) { |
||
24 | $result[$property->name()] = $property; |
||
25 | |||
26 | return $result; |
||
27 | }, []); |
||
28 | |||
29 | parent::__construct(\compact('entity', 'action', 'properties', 'command')); |
||
30 | } |
||
31 | |||
32 | protected function getFileTemplate(): string |
||
33 | { |
||
34 | return 'Command.php.twig'; |
||
35 | } |
||
36 | |||
37 | protected function getPathTemplate(): string |
||
40 | } |
||
41 | } |
||
42 |