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

Method extractRow

lib/Datasource/LocalJson.php:209–222  ·  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

207 * Extracts a single row's values based on the given paths.
208 */
209 private function extractRow($rowArray, array $paths): array {
210 $row = [];
211 foreach ($paths as $path) {
212 $value = $this->get_nested_array_value($rowArray, $path);
213 // If value is null, use the path as a placeholder
214 if ($value === null) {
215 $value = $path;
216 } elseif (is_array($value)) {
217 $value = implode(', ', array_map('strval', $value));
218 }
219 $row[] = $value;
220 }
221 return $row;
222 }
223
224 /**
225 * Extracts single values for each path, handling arrays and scalars.

Callers 1

extractRowsFromArrayMethod · 0.95

Calls 1

Tested by

no test coverage detected