Exposing GitLab's project metadata (#11734)
* Exposing GitLab's project metadata * Fixed check about GitLab project's metadata initializationpull/11777/head
parent
6198fc1053
commit
8e62977cb5
|
@ -43,7 +43,7 @@ class GitLabDriver extends VcsDriver
|
||||||
/**
|
/**
|
||||||
* @var mixed[] Project data returned by GitLab API
|
* @var mixed[] Project data returned by GitLab API
|
||||||
*/
|
*/
|
||||||
private $project;
|
private $project = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var array<string|int, mixed[]> Keeps commits returned by GitLab API as commit id => info
|
* @var array<string|int, mixed[]> Keeps commits returned by GitLab API as commit id => info
|
||||||
|
@ -381,6 +381,10 @@ class GitLabDriver extends VcsDriver
|
||||||
|
|
||||||
protected function fetchProject(): void
|
protected function fetchProject(): void
|
||||||
{
|
{
|
||||||
|
if (!is_null($this->project)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// we need to fetch the default branch from the api
|
// we need to fetch the default branch from the api
|
||||||
$resource = $this->getApiUrl();
|
$resource = $this->getApiUrl();
|
||||||
$this->project = $this->getContents($resource, true)->decodeJson();
|
$this->project = $this->getContents($resource, true)->decodeJson();
|
||||||
|
@ -581,6 +585,18 @@ class GitLabDriver extends VcsDriver
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gives back the loaded <gitlab-api>/projects/<owner>/<repo> result
|
||||||
|
*
|
||||||
|
* @return mixed[]|null
|
||||||
|
*/
|
||||||
|
public function getRepoData(): ?array
|
||||||
|
{
|
||||||
|
$this->fetchProject();
|
||||||
|
|
||||||
|
return $this->project;
|
||||||
|
}
|
||||||
|
|
||||||
protected function getNextPage(Response $response): ?string
|
protected function getNextPage(Response $response): ?string
|
||||||
{
|
{
|
||||||
$header = $response->getHeader('link');
|
$header = $response->getHeader('link');
|
||||||
|
|
Loading…
Reference in New Issue