Get daily downloads badge image

@param Repo $repo
@return string
350857
public function getDailyDownloadBadge(Repo $repo)
    {
        if ($repo->getPackagistSlug()) {
            return sprintf('<img src="%s" />', $this->helper->getDailyDownloadBadgeUrl($repo->getPackagistSlug()));
        }

        return '';
    }
411173
public function get($account, $repo, $linkID)
    {
        return $this->requestGet(
            sprintf('repositories/%s/%s/links/%d', $account, $repo, $linkID)
        );
    }
1004677
public function createRepo(string $repo = null)
    {
        $end = $this->getVendorType() === 'org'
            ?'/orgs/' . $this->getVendor() . '/repos'
            : '/user/repos'
        ;
        $res = $this->request('POST', $end, [
            'name'        => $this->getName(),
            'description' => $this->getDescription(),
        ]);
        if (Helper::isResponseOk($res)) {
            echo "\ngit remote add origin git@github.com:{$this->getFullName()}.git\n";
            echo "git push -u origin master\n";
        }

        return $res;
    }
1008570
protected function parse_tags( $response, $repo_type ) {
		$tags     = [];
		$rollback = [];

		foreach ( (array) $response as $tag ) {
			$download_link    = "/projects/{$this->get_gitlab_id()}/repository/archive.zip";
			$download_link    = $this->get_api_url( $download_link );
			$download_link    = add_query_arg( 'sha', $tag, $download_link );
			$tags[]           = $tag;
			$rollback[ $tag ] = $download_link;
		}

		return [ $tags, $rollback ];
	}
155577
public function load(Repo $repo)
    {
        // Travis own its ID
        $id = $repo->getId();
        $this->client->fetchRepository($repo);
        $repo->setId($id);

        return $repo;
    }
544752
function get (repo, cb) {
    try {
      Gitters.fetch(repo.username + '/' + repo.repo, function(data){
        cb.call(null, repo, data)
      }, /* bubble error */ true)
    } catch(err) {
      log(err.message)
    }
  }
589572
public function urlForRepository(string $user, string $repo): string
    {
        $key = sprintf(self::CACHE_KEY_TEMPLATE, md5($user . $repo), 'repo_url');

        if (($latest = $this->getFromCache($key)) !== null) {
            return $latest;
        }

        $api = $this->client->api('repo');
        $params = [$user, $repo];

        $repo = $this->callGitHub([$api, 'show'], $params);

        $url = $repo['html_url'] ?? '';

        $this->setToCache($key, $url, 30);
        return $url;
    }
290570
public function getCoverageBadge(Repo $repo)
    {
        if ($repo->getCoverageBadgeHash()) {
            return sprintf(
                '<img src="%s" />',
                $this->helper->getCoverageBadgeUrl(
                    $repo->getSlug(),
                    $repo->getType(),
                    $repo->getCoverageBadgeHash()
                )
            );
        }

        return '';
    }
908576
public function get_current_branch( $repo ) {
		$current_branch = ! empty( $this->cache['current_branch'] )
			? $this->cache['current_branch']
			: $repo->branch;

		return $current_branch;
	}
501086
protected function return_repo_type() {
		$arr         = [];
		$arr['type'] = $this->type->type;

		switch ( $this->type->git ) {
			case 'github':
				$arr['git']           = 'github';
				$arr['base_uri']      = 'https://api.github.com';
				$arr['base_download'] = 'https://github.com';
				break;
			case 'bitbucket':
				$arr['git'] = 'bitbucket';
				if ( empty( $this->type->enterprise ) ) {
					$arr['base_uri']      = 'https://api.bitbucket.org';
					$arr['base_download'] = 'https://bitbucket.org';
				} else {
					$arr['base_uri']      = $this->type->enterprise_api;
					$arr['base_download'] = $this->type->enterprise;
				}
				break;
			case 'gitlab':
				$arr['git']           = 'gitlab';
				$arr['base_uri']      = 'https://gitlab.com/api/v4';
				$arr['base_download'] = 'https://gitlab.com';
				break;
			case 'gitea':
				$arr['git']           = 'gitea';
				$arr['base_uri']      = $this->type->enterprise . '/api/v1';
				$arr['base_download'] = $this->type->enterprise;
				break;
		}

		return $arr;
	}
336168
public function repository(string $user, string $repo): ?array
    {
        $api = $this->client->api('repo');
        $params = [$user, $repo];

        $repo = $this->callGitHub([$api, 'show'], $params);

        return is_array($repo) ? $repo : null;
    }
327352
def get_repo(self, repo: str, branch: str, *,
                 depth: Optional[int]=1,
                 reference: Optional[Path]=None
                 ) -> Repo:
        
        git_repo, _ = self.get_files(repo, branch, depth=depth, reference=reference)

        return git_repo
55001
private function getCommits($org, $repo, $version)
    {
        $url = sprintf(
            self::GITHUB_COMPARE_ENDPOINT,
            $org,
            $repo,
            $version
        );

        $res = json_decode($this->http->get($url, [
            'auth' => [null, $this->token]
        ])->getBody(), true);
        $commits = [];
        foreach ($res['commits'] as $commit) {
            $message = $commit['commit']['message'];

            $description = explode("\n", $message)[0];
            $matches = [];
            if (preg_match('/(.{0,})\(\#(\d{1,})\)/', $description, $matches) === 1) {
                $message = trim($matches[1]);
                $prNumber = isset($matches[2]) ? $matches[2] : null;
            } else {
                $prNumber = $this->askForPrNumber($message);
            }

            if (strpos($message, '[CHANGE ME]') === 0 && $prNumber) {
                $message = $this->getMessageFromPullRequest($org, $repo, $prNumber);
            }

            $commits[] = [
                'url' => $commit['url'],
                'htmlUrl' => $commit['html_url'],
                'message' => $message,
                'reference' => $prNumber,
                'hash' => $commit['sha']
            ];
        }

        return $commits;
    }
921167
public function getTheReadme($owner, $repo, $ref = null)
	{
		$data = array();
		if(!is_null($ref))
			$data['ref'] = $ref;
		
		return $this->client->request("/repos/$owner/$repo/readme", 'GET', $data, 200, 'GitHubRepoContent');
	}
853859
def repo_id(self, repo: str) -> str:
        
        if repo.startswith("http"):
            repo_id = re.sub(r"https?://(.www)?", "", repo)
            repo_id = re.sub(r"\.git/?$", "", repo_id)
        else:
            repo_id = repo.replace("file://", "")
            repo_id = re.sub(r"\.git/?$", "", repo_id)
            if repo_id.startswith("~"):
                repo_id = str(Path(repo_id).resolve())

        # replaces everything that isn't alphanumeric, a dot or an underscore
        # to make sure it's a valid folder name and to keep it readable
        # multiple consecutive invalid characters replaced with a single underscore
        repo_id = re.sub(r"[^a-zA-Z0-9._]+", "_", repo_id)

        # and add a hash of the original to make it absolutely unique
        return repo_id + hashlib.sha256(repo.encode("utf-8")).hexdigest()
537498
public function releaseRepo($release = null)
    {
        $release = $this->take('version')->getRelease($release);
        $notes = $this->take('chkipper')->getReleaseNotes();
        $wait = $this->waitPush();
        if ($wait) {
            return $wait;
        }

        return $this->request('POST', '/repos/' . $this->getFull_name() . '/releases', [
            'tag_name'  => $release,
            'name'      => $release,
            'body'      => $notes,
        ]);
    }
387548
protected function getForm($repo = null)
    {
        if ($repo == null) {
            $repo = $this->getManager()->createNew();
        }

        return $this->createForm(
            $this->container->get('snide_travinizer.form.repo_type'),
            $repo
        );
    }