| Conditions | 3 |
| Paths | 3 |
| Total Lines | 16 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 12 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 15 | public static function createArray(array $keys, array $values): array { |
||
| 16 | $array = [ ]; |
||
| 17 | $count = count($keys); |
||
| 18 | |||
| 19 | $keys = array_values($keys); |
||
| 20 | $values = array_values($values); |
||
| 21 | |||
| 22 | if(count($keys) !== count($values)) { |
||
| 23 | throw new InvalidArgumentException('$keys and $items parameter need to have the same length.'); |
||
| 24 | } |
||
| 25 | |||
| 26 | for($i = 0; $i < $count; $i++) { |
||
| 27 | $array[$keys[$i]] = $values[$i]; |
||
| 28 | } |
||
| 29 | |||
| 30 | return $array; |
||
| 31 | } |
||
| 43 | } |