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

Method extractRowsFromArray

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

233 * Extracts rows from an array of arrays, using the provided paths.
234 */
235 private function extractRowsFromArray($json, array $paths): array {
236 $data = [];
237 if (is_array($json) && is_array(reset($json))) {
238 foreach ($json as $rowArray) {
239 $data[] = $this->extractRow($rowArray, $paths);
240 }
241 } else {
242 $data[] = $this->extractRow($json, $paths);
243 }
244 return $data;
245 }
246
247 /**
248 * 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