| Conditions | 2 |
| Paths | 2 |
| Total Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 6 |
| Changes | 0 | ||
| 1 | <?php |
||
| 49 | protected function parseRequestPdfLetterField() |
||
| 50 | { |
||
| 51 | if ($this->getRequest()->get('id_letter')) { |
||
| 52 | $this->pdfLetter = $this->checkForeignModelFromRequest( |
||
| 53 | $this->getModelManager()->getLetterManager()->getTable(), |
||
| 54 | 'id_letter' |
||
| 55 | ); |
||
| 56 | } else { |
||
| 57 | $field = $this->getModelFromRequest(); |
||
| 58 | $this->pdfLetter = $field->getPdfLetter(); |
||
| 59 | } |
||
| 60 | |||
| 61 | $this->parent = $this->pdfLetter->getItem(); |
||
| 62 | } |
||
| 63 | |||
| 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.