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