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