Conditions | 1 |
Paths | 1 |
Total Lines | 17 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 2 |
Changes | 0 |
1 | <?php |
||
19 | protected function setupClass(PhpNamespace $namespace): object |
||
20 | { |
||
21 | $base = EntityCollectionFactoryInterface::class; |
||
22 | $return = explode('\\', $this->collection); |
||
23 | $return = end($return); |
||
24 | |||
25 | $class = $namespace->addUse($base)->addClass($this->class); |
||
26 | |||
27 | $class->addImplement($base); |
||
28 | $class->addMethod('createEntityCollection') |
||
29 | ->setVariadic(true) |
||
30 | ->setReturnType($this->collection) |
||
31 | ->setBody(sprintf('return new %s(...$entities);', $return)) |
||
32 | ->addParameter('entities') |
||
33 | ->setType('object'); |
||
34 | |||
35 | return $class; |
||
36 | } |
||
38 |