* Extracts a single row's values based on the given paths. */
($rowArray, array $paths)
| 207 | * Extracts a single row's values based on the given paths. |
| 208 | */ |
| 209 | private function extractRow($rowArray, array $paths): array { |
| 210 | $row = []; |
| 211 | foreach ($paths as $path) { |
| 212 | $value = $this->get_nested_array_value($rowArray, $path); |
| 213 | // If value is null, use the path as a placeholder |
| 214 | if ($value === null) { |
| 215 | $value = $path; |
| 216 | } elseif (is_array($value)) { |
| 217 | $value = implode(', ', array_map('strval', $value)); |
| 218 | } |
| 219 | $row[] = $value; |
| 220 | } |
| 221 | return $row; |
| 222 | } |
| 223 | |
| 224 | /** |
| 225 | * Extracts single values for each path, handling arrays and scalars. |
no test coverage detected