* Extracts a single row's values based on the given paths. */
($rowArray, array $paths)
| 243 | * Extracts a single row's values based on the given paths. |
| 244 | */ |
| 245 | private function extractRow($rowArray, array $paths): array { |
| 246 | $row = []; |
| 247 | foreach ($paths as $path) { |
| 248 | $value = $this->get_nested_array_value($rowArray, $path); |
| 249 | // If value is null, use the path as a placeholder |
| 250 | if ($value === null) { |
| 251 | $value = $path; |
| 252 | } elseif (is_array($value)) { |
| 253 | $value = implode(', ', array_map('strval', $value)); |
| 254 | } |
| 255 | $row[] = $value; |
| 256 | } |
| 257 | return $row; |
| 258 | } |
| 259 | |
| 260 | /** |
| 261 | * Extracts single values for each path, handling arrays and scalars. |
no test coverage detected