| Conditions | 3 |
| Paths | 3 |
| Total Lines | 15 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 36 | public function hydrateDocument(DOMDocument $document): array |
||
| 37 | { |
||
| 38 | $translator = new XmlTranslator(); |
||
| 39 | $elements = $translator->translateDocument($document); |
||
| 40 | |||
| 41 | $output = []; |
||
| 42 | foreach ($elements as $element) { |
||
| 43 | $hydrat = $this->hydrate($element); |
||
| 44 | if ($hydrat->isValid()) { |
||
| 45 | $output[] = $hydrat->getHydratable(); |
||
| 46 | } |
||
| 47 | } |
||
| 48 | |||
| 49 | return $output; |
||
| 50 | } |
||
| 51 | |||
| 77 | } |
Unless you are absolutely sure that the expression can never be null because of other conditions, we strongly recommend to add an additional type check to your code: