MCPcopy Create free account
hub / github.com/Rello/analytics / extractRow

Method extractRow

lib/Datasource/ExternalJson.php:250–263  ·  view source on GitHub ↗

* Extracts a single row's values based on the given paths. */

($rowArray, array $paths)

Source from the content-addressed store, hash-verified

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

Callers 1

extractRowsFromArrayMethod · 0.95

Calls 1

Tested by

no test coverage detected