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

Method extractRow

lib/Datasource/ExternalJson.php:244–257  ·  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

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.

Callers 1

extractRowsFromArrayMethod · 0.95

Calls 1

Tested by

no test coverage detected