| Conditions | 2 |
| Paths | 2 |
| Total Lines | 20 |
| Code Lines | 12 |
| Lines | 7 |
| Ratio | 35 % |
| Tests | 13 |
| CRAP Score | 2 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 31 | 2 | public function generate($forceOverwrite = false) |
|
| 32 | { |
||
| 33 | 2 | View Code Duplication | if (!$this->canWriteToFile($forceOverwrite)) { |
| 34 | 1 | throw new \RuntimeException(sprintf( |
|
| 35 | 1 | 'Unable to generate the %s Repository class as it already exists under the file: %s', |
|
| 36 | 1 | $this->helper->getEntityClass(), |
|
| 37 | 1 | $this->helper->getRepositoryFullFilename() |
|
| 38 | )); |
||
| 39 | } |
||
| 40 | |||
| 41 | 1 | $this->renderFile( |
|
| 42 | 1 | 'repository/repository.php.twig', |
|
| 43 | 1 | $this->helper->getRepositoryFullFilename(), |
|
| 44 | [ |
||
| 45 | 1 | 'alias' => strtolower($this->helper->getEntityClass()[0]), |
|
| 46 | 1 | 'class' => $this->helper->getRepositoryClass(), |
|
| 47 | 1 | 'namespace' => $this->helper->getRepositoryNamespace() |
|
| 48 | ] |
||
| 49 | ); |
||
| 50 | 1 | } |
|
| 51 | } |
||
| 52 |
If you implement
__calland you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.This is often the case, when
__callis implemented by a parent class and only the child class knows which methods exist: