| Conditions | 2 |
| Paths | 2 |
| Total Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 6 |
| Changes | 0 | ||
| 1 | <?php |
||
| 30 | public function addNewModel() |
||
| 31 | { |
||
| 32 | /** @var PdfLetterTrait $item */ |
||
| 33 | $item = $this->getModelManager()->getNew(); |
||
| 34 | if ($this->pdfLetter) { |
||
| 35 | $item->populateFromLetter($this->pdfLetter); |
||
| 36 | $this->getView()->Breadcrumbs()->addItem( |
||
| 37 | $this->getModelManager()->getLetterManager()->getLabel('add'), |
||
| 38 | '#' |
||
| 39 | ); |
||
| 40 | return $item; |
||
| 41 | } |
||
| 42 | |||
| 43 | return $this->forward('index', 'error'); |
||
| 44 | } |
||
| 45 | |||
| 76 | } |
In PHP traits cannot be used for type-hinting as they do not define a well-defined structure. This is because any class that uses a trait can rename that trait’s methods.
If you would like to return an object that has a guaranteed set of methods, you could create a companion interface that lists these methods explicitly.