diff --git a/src/Composer/Repository/Vcs/GitLabDriver.php b/src/Composer/Repository/Vcs/GitLabDriver.php index 1e13154c5..3721419b1 100644 --- a/src/Composer/Repository/Vcs/GitLabDriver.php +++ b/src/Composer/Repository/Vcs/GitLabDriver.php @@ -43,7 +43,7 @@ class GitLabDriver extends VcsDriver /** * @var mixed[] Project data returned by GitLab API */ - private $project; + private $project = null; /** * @var array Keeps commits returned by GitLab API as commit id => info @@ -381,6 +381,10 @@ class GitLabDriver extends VcsDriver protected function fetchProject(): void { + if (!is_null($this->project)) { + return; + } + // we need to fetch the default branch from the api $resource = $this->getApiUrl(); $this->project = $this->getContents($resource, true)->decodeJson(); @@ -581,6 +585,18 @@ class GitLabDriver extends VcsDriver return true; } + /** + * Gives back the loaded /projects// result + * + * @return mixed[]|null + */ + public function getRepoData(): ?array + { + $this->fetchProject(); + + return $this->project; + } + protected function getNextPage(Response $response): ?string { $header = $response->getHeader('link');