public getContributorNames ( |
||
$bundle |
public function getContributorNames(Bundle $bundle)
{
try {
$contributors = $this->github->api('repo')->contributors($bundle->getOwnerName(), $bundle->getName());
} catch (RuntimeException $e) {
return array();
}
$names = array();
foreach ($contributors as $contributor) {
if ($bundle->getOwnerName() != $contributor['login']) {
$names[] = $contributor['login'];
}
}
return $names;
}
/** * Takes a bundle and update its contributors * * @param Bundle $bundle */ private function updateContributors(Bundle $bundle) { $contributorNames = $this->githubRepoApi->getContributorNames($bundle); $contributors = array(); foreach ($contributorNames as $contributorName) { $contributors[] = $this->ownerManager->createOwner($contributorName, 'unknown'); } $bundle->setContributors($contributors); if ($this->logger) { $this->logger->info(sprintf('%d contributor(s) have been retrieved for bundle %s', count($contributors), $bundle->getName())); } }