'https://', 'git://' => 'https://', '.git' => $file ? '/raw/master/' . $file : '/', ]); } /** * @param $endpoint * @param $file * @return string */ private static function getGitHubComUrl($endpoint, $file) { return strtr($endpoint, [ 'https://' => $file ? 'https://raw.' : 'https://', 'http://' => $file ? 'https://raw.' : 'https://', 'git://' => $file ? 'https://raw.' : 'https://', '.git' => $file ? '/master/' . $file : '/', ]); } /** * @param $endpoint * @param $file * @return string */ private static function getRepoOrCzUrl($endpoint, $file) { return strtr($endpoint, [ 'http://' => 'https://', 'git://' => 'https://', '.git' => $file ? '.git/blob_plain/master:/' . $file : '.git', ]); } }