/** * @return RepositoryInterface[] */ public function getRepositories() { $owner = $this->getUser(); $repositories = []; $page = 1; do { $response = $this->sendClientRequest('get', sprintf($this->endpoints['repositories'], $owner . '?' . http_build_query(['page' => $page, 'format' => 'json'])), [], true); $chunk = json_decode($response->getBody()->getContents(), true); foreach ($chunk['values'] as $definition) { $clone = null; foreach ($definition['links']['clone'] as $link) { if ('https' === $link['name']) { $clone = $link['href']; break; } } $repository = new BitBucketRepository($definition['full_name'], $definition['description'], $clone); $repository->setSize($definition['size']); $repository->setPrivate($definition['is_private']); $repository->setUpdatedAt(new \DateTime($definition['updated_on'])); $repository->setRemote($this); $this->getEmitter()->emit(GitRepositoryEvent::prepare('git_remote.repository_discovery', $repository, 'discovery', null, ['definition' => $definition])); $repositories[] = $repository; } $page++; } while (isset($chunk) && is_array($chunk) && isset($chunk['next']) && count($chunk['values']) > 0); return $repositories; }
/** * @expectedException \InvalidArgumentException */ public function textCrossExceptionGHBB() { $remote = new GitHubRemote(); $repository = new BitBucketRepository('test/test', 'a test', 'https://bitbucket.org/test/test.git'); $repository->setRemote($remote); }