getRepositoryInfo() public method

Returned value must be an array with the following data (values are by example). If a value is not supported null must be used instead, or false in case of a boolean. "owner": "username" "html_url": "https://github.com/octocat/Hello-World" "fetch_url": "https://github.com/octocat/Hello-World.git" "push_url": "git@github.com:octocat/Hello-World.git" "is_fork": false "is_private": false "fork_origin": [ "org": null "repo": null ] fork_origin is used to find the original organization and repository. When this repository is the head-parent, "fork_origin" may be null.
public getRepositoryInfo ( string $org, string $repository ) : array
$org string
$repository string
return array
Exemplo n.º 1
0
 /**
  * @param Adapter     $adapter
  * @param string|null $org
  * @param string|null $repo
  *
  * @throws UserException
  *
  * @return array [org, repo]
  */
 protected function getRepositoryReference(Adapter $adapter, $org, $repo)
 {
     $remote = $this->findRemoteName(false);
     $repoInfo = $this->gitConfigHelper->getRemoteInfo($remote);
     if (null === $org) {
         $org = $repoInfo['vendor'];
     }
     if (null === $repo) {
         $repo = $repoInfo['repo'];
     }
     $adapterRepoInfo = $adapter->getRepositoryInfo($org, $repo);
     if ($adapterRepoInfo['is_fork']) {
         $org = $adapterRepoInfo['fork_origin']['org'];
         $repo = $adapterRepoInfo['fork_origin']['repo'];
     }
     return [$org, $repo];
 }