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

Method extractAbsolutePathIfPresent

lib/Datasource/LocalJson.php:172–179  ·  view source on GitHub ↗

* If an absolute path precedes the array fields, extract the sub-array. */

($json, string $path)

Source from the content-addressed store, hash-verified

170 * If an absolute path precedes the array fields, extract the sub-array.
171 */
172 private function extractAbsolutePathIfPresent($json, string $path) {
173 $firstBracePos = strpos($path, '{');
174 if ($firstBracePos !== false && $firstBracePos > 0) {
175 $absolutePath = substr($path, 0, $firstBracePos);
176 return $this->get_nested_array_value($json, $absolutePath);
177 }
178 return $json;
179 }
180
181 /**
182 * Ensures the paths array has at least $minCount elements, padding with $fill if needed.

Callers 1

jsonParserMethod · 0.95

Calls 1

Tested by

no test coverage detected