/**
* Return true if the Repo exists on GitHub, false otherwise
*
* @param Entity\Bundle $bundle
* @param array $data
* @return boolean whether the Repo exists on GitHub
*/
public function updateInfos(Entity\Bundle $bundle)
{
$this->output->write(' infos');
try {
$data = $this->github->getRepoApi()->show($bundle->getUsername(), $bundle->getName());
} catch (\Github_HttpClient_Exception $e) {
if (404 == $e->getCode()) {
return false;
}
throw $e;
}
if ($data['fork']) {
if ($data['watchers'] >= 10) {
// Let's try to keep a forked repo with lots of watchers
} else {
return false;
}
}
$bundle->setDescription(empty($data['description']) ? null : $data['description']);
$bundle->setNbFollowers($data['watchers']);
$bundle->setNbForks($data['forks']);
$bundle->setCreatedAt(new \DateTime($data['created_at']));
$bundle->setHomepage(empty($data['homepage']) ? null : $data['homepage']);
return $bundle;
}