| Conditions | 8 |
| Paths | 8 |
| Total Lines | 28 |
| Code Lines | 17 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 14 |
| CRAP Score | 8.0189 |
| Changes | 0 | ||
| 1 | <?php declare(strict_types = 1); |
||
| 33 | 12 | private function generateMessage(array $data, array $keys): array |
|
| 34 | { |
||
| 35 | 12 | $message = []; |
|
| 36 | |||
| 37 | 12 | foreach ($keys as $key => $values) { |
|
| 38 | 8 | if (is_int($key)) { |
|
| 39 | 3 | foreach ($data as $items) { |
|
| 40 | 3 | $message = array_merge($message, $this->generateMessage($items, $values)); |
|
| 41 | } |
||
| 42 | 3 | continue; |
|
| 43 | } |
||
| 44 | 8 | if (!array_key_exists($key, $data)) { |
|
| 45 | 4 | continue; |
|
| 46 | } |
||
| 47 | |||
| 48 | 8 | if (is_array($values)) { |
|
| 49 | 4 | $message = array_merge($message, $this->generateMessage($data[$key], $values)); |
|
| 50 | } else { |
||
| 51 | 8 | if (is_bool($data[$key])) { |
|
| 52 | $message[] = $data[$key] ? 'true' : 'false'; |
||
| 53 | } else { |
||
| 54 | 8 | $message[] = $data[$key]; |
|
| 55 | } |
||
| 56 | } |
||
| 57 | } |
||
| 58 | |||
| 59 | 12 | return $message; |
|
| 60 | } |
||
| 61 | |||
| 63 |