Total Complexity | 3 |
Total Lines | 43 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php declare(strict_types=1); |
||
16 | final class RepositoryBuilder extends AbstractBuilder |
||
17 | 1 | { |
|
18 | 1 | public function __construct(SchemaInterface $schema, array $actions) |
|
19 | { |
||
20 | 1 | $login = 'email'; |
|
21 | $item = $this->getInflector()->item($schema->name()); |
||
22 | 1 | $entity = $this->getInflector()->entity($schema->name()); |
|
23 | $fkFns = $this->getFkFunctions($schema->fkRelations()); |
||
24 | $pkName = $this->getInflector()->pascalProperty($schema->pkName()); |
||
25 | 1 | ||
26 | $requests = []; |
||
27 | 1 | $actions = \array_reduce($actions, function (array $result, string $action) use (&$requests) { |
|
28 | $result[] = $this->getInflector()->camelAction($action); |
||
29 | $requests[] = $this->getInflector()->pascalAction($action); |
||
30 | |||
31 | return $result; |
||
32 | }, []); |
||
33 | $header = self::getHeaderFile(); |
||
34 | $usePatch = $schema->hasAction(Action::PATCH); |
||
35 | |||
36 | parent::__construct( |
||
37 | \compact( |
||
38 | 'header', |
||
39 | 'entity', |
||
40 | 'item', |
||
41 | 'actions', |
||
42 | 'requests', |
||
43 | 'login', |
||
44 | 'fkFns', |
||
45 | 'pkName', |
||
46 | 'usePatch' |
||
47 | ) |
||
48 | ); |
||
49 | } |
||
50 | |||
51 | protected function getFileTemplate(): string |
||
54 | } |
||
55 | |||
56 | protected function getPathTemplate(): string |
||
59 | } |
||
60 | } |
||
61 |