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

Method extractRow

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

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.

Callers 1

extractRowsFromArrayMethod · 0.95

Calls 1

Tested by

no test coverage detected