| Conditions | 3 |
| Paths | 3 |
| Total Lines | 23 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 32 | public static function toResults($items) { |
||
| 33 | |||
| 34 | // Initialize the output. |
||
| 35 | $output = []; |
||
| 36 | |||
| 37 | // Handle each item. |
||
| 38 | foreach ($items as $current) { |
||
| 39 | |||
| 40 | // Check the item. |
||
| 41 | if (false === ($current instanceof Select2DataFormatInterface)) { |
||
| 42 | throw new IllegalArgumentException("The item must implements Select2DataFormatInterface"); |
||
| 43 | } |
||
| 44 | |||
| 45 | // Add the item. |
||
| 46 | $output[] = [ |
||
| 47 | "id" => $current->getSelect2DataFormatId(), |
||
| 48 | "text" => $current->getSelect2DataFormatText(), |
||
| 49 | ]; |
||
| 50 | } |
||
| 51 | |||
| 52 | // Return the output. |
||
| 53 | return $output; |
||
| 54 | } |
||
| 55 | |||
| 57 |