VersionPress\Utils\ReferenceUtils::getMatchingPathsFromSubtree PHP Method

getMatchingPathsFromSubtree() private static method

private static getMatchingPathsFromSubtree ( $value, $pathParts )
    private static function getMatchingPathsFromSubtree($value, $pathParts)
    {
        if (!is_array($value) && !is_object($value)) {
            return [];
        }
        $currentLevelKey = array_shift($pathParts);
        $paths = [];
        foreach ($value as $key => $subTree) {
            if ($currentLevelKey['type'] === 'exact-value' && $currentLevelKey['value'] === $key || $currentLevelKey['type'] === 'regex' && preg_match($currentLevelKey['value'], $key)) {
                if (count($pathParts) > 0) {
                    $subPaths = self::getMatchingPathsFromSubtree($subTree, $pathParts);
                    foreach ($subPaths as $subPath) {
                        array_unshift($subPath, $key);
                        $paths[] = $subPath;
                    }
                } else {
                    $paths[] = [$key];
                }
            }
        }
        return $paths;
    }