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

Method extractRowsFromArray

lib/Datasource/ExternalJson.php:230–240  ·  view source on GitHub ↗

* Extracts rows from an array of arrays, using the provided paths. */

($json, array $paths)

Source from the content-addressed store, hash-verified

228 * Extracts rows from an array of arrays, using the provided paths.
229 */
230 private function extractRowsFromArray($json, array $paths): array {
231 $data = [];
232 if (is_array($json) && is_array(reset($json))) {
233 foreach ($json as $rowArray) {
234 $data[] = $this->extractRow($rowArray, $paths);
235 }
236 } else {
237 $data[] = $this->extractRow($json, $paths);
238 }
239 return $data;
240 }
241
242 /**
243 * Extracts a single row's values based on the given paths.

Callers 1

jsonParserMethod · 0.95

Calls 2

extractRowMethod · 0.95
resetFunction · 0.85

Tested by

no test coverage detected