in lib/php/libsdk/SDK/Config.php [135:176]
public static function getKnownBranches() : array
{/*{{{*/
if (empty(self::$knownBranches)) {
$cache_file = "known_branches.txt";
$deps_path = self::getDepsLocalPath();
if (!$deps_path) {
throw new Exception("Couldn't determine dependencies path. Please either switch to the PHP source root or use -d option.");
}
$cache = new Cache($deps_path);
$fetcher = new Fetcher(self::$depsHost, self::$depsPort, self::$depsUriScheme);
$tmp = $fetcher->getByUri(self::$depsBaseUri . "/series/");
if (false !== $tmp) {
$data = array();
if (preg_match_all(",/packages-(.+)-(v[cs]\d+)-(x86|x64)-(stable|staging)\.txt,U", $tmp, $m, PREG_SET_ORDER)) {
foreach ($m as $b) {
if (!isset($data[$b[1]])) {
$data[$b[1]] = array();
}
$data[$b[1]][$b[2]][] = array("arch" => $b[3], "stability" => $b[4]);
}
$cache->cachecontent($cache_file, json_encode($data, JSON_PRETTY_PRINT), true);
}
} else {
/* It might be ok to use cached branches list, if a fetch failed. */
$tmp = $cache->getCachedContent($cache_file, true);
if (NULL == $tmp) {
throw new Exception("No cached branches list found");
}
$data = json_decode($tmp, true);
}
if (!is_array($data) || empty($data)) {
throw new Exception("Failed to fetch supported branches");
}
self::$knownBranches = $data;
}
return self::$knownBranches;
}/*}}}*/