| Conditions | 1 |
| Paths | 1 |
| Total Lines | 24 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 2 |
| Changes | 0 | ||
| 1 | <?php |
||
| 41 | protected function setupClass(PhpNamespace $namespace): object |
||
| 42 | { |
||
| 43 | $util = PoweredByModelCollectionKernelTrait::class; |
||
| 44 | |||
| 45 | $namespace |
||
| 46 | ->addUse($this->type) |
||
| 47 | ->addUse($this->extends) |
||
| 48 | ->addUse($this->model) |
||
| 49 | ->addUse($util); |
||
| 50 | |||
| 51 | $class = $namespace->addClass($this->class) |
||
| 52 | ->setExtends($this->extends) |
||
| 53 | ->addImplement($this->type); |
||
| 54 | |||
| 55 | $class->addTrait($util); |
||
| 56 | // $class->addConstant('MODEL_IDENTIFIER', 'id')->setProtected(); |
||
| 57 | // $class->addConstant('COLLECTION_IS_MAP', true)->setProtected(); |
||
| 58 | |||
| 59 | $constructor = $class->addMethod('__construct')->setVariadic(true); |
||
| 60 | |||
| 61 | $constructor->addParameter($this->plural)->setType($this->model); |
||
| 62 | $constructor->setBody(sprintf('$this->initKernel($%s);', $this->plural)); |
||
| 63 | |||
| 64 | return $class; |
||
| 65 | } |
||
| 67 |