| Conditions | 5 |
| Paths | 7 |
| Total Lines | 23 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 16 | public function convertToAssociationTree($associations): AssociationTree |
||
| 17 | { |
||
| 18 | if ($associations instanceof AssociationTree) { |
||
| 19 | return $associations; |
||
| 20 | } |
||
| 21 | |||
| 22 | $associationsTreeBuilder = new AssociationTreeBuilder(); |
||
| 23 | |||
| 24 | if (is_string($associations)) { |
||
| 25 | $associations = explode('.', $associations); |
||
| 26 | } |
||
| 27 | |||
| 28 | if (is_array($associations)) { |
||
|
|
|||
| 29 | foreach ($associations as $association) { |
||
| 30 | $associationsTreeBuilder->associate($association); |
||
| 31 | } |
||
| 32 | |||
| 33 | return $associationsTreeBuilder->create(); |
||
| 34 | } |
||
| 35 | |||
| 36 | // This code should not be reached. |
||
| 37 | // @phpstan-ignore-next-line |
||
| 38 | throw new \InvalidArgumentException(); |
||
| 39 | } |
||
| 41 |