public function getApiByOwnerName($ownerName)
{
try {
$githubOwner = $this->github->api('user')->show($ownerName);
// Data fetched, but not in expected format ?
if (!isset($githubOwner['type'])) {
return false;
}
} catch (RuntimeException $e) {
// Api limit? User/organization not found? Don't continue
return false;
}
if ($githubOwner['type'] != 'Organization') {
$api = new GithubDeveloper($this->github, new NullOutput());
} else {
$api = new GithubOrganization($this->github, new NullOutput());
$api->setOwnerManager($this);
}
return $api;
}