class GitLabDriver extends VcsDriver (View source)

Driver for GitLab API, use the Git driver for local checkouts.

Constants

URL_REGEX

Properties

protected string $url from VcsDriver
protected string $originUrl from VcsDriver
protected array $repoConfig from VcsDriver
protected IOInterface $io from VcsDriver
protected Config $config from VcsDriver
protected ProcessExecutor $process from VcsDriver
protected RemoteFilesystem $remoteFilesystem from VcsDriver
protected array $infoCache from VcsDriver
protected Cache $cache from VcsDriver
protected GitDriver $gitDriver Git Driver
protected int $portNumber

Methods

__construct(array $repoConfig, IOInterface $io, Config $config, ProcessExecutor $process = null, RemoteFilesystem $remoteFilesystem = null)

Constructor.

from VcsDriver
bool
shouldCache(string $identifier)

Returns whether or not the given $identifier should be cached or not.

from VcsDriver
array
getComposerInformation(string $identifier)

Return the composer.json file information

from VcsDriver
getBaseComposerInformation($identifier)

No description

from VcsDriver
bool
hasComposerFile(string $identifier)

Return true if the repository has a composer file for a given identifier, false otherwise.

from VcsDriver
string
getScheme()

Get the https or http protocol depending on SSL support.

from VcsDriver
mixed
getContents(string $url, $fetchingRepoData = false)

Get the remote content.

cleanup()

Performs any cleanup necessary as the driver is not longer needed

from VcsDriver
initialize()

Extracts information from the repository url.

setRemoteFilesystem(RemoteFilesystem $remoteFilesystem)

Updates the RemoteFilesystem instance.

string
getFileContent(string $file, string $identifier)

Return the content of $file or null if the file does not exist.

getChangeDate(string $identifier)

Get the changedate for $identifier.

getRepositoryUrl()

{@inheritDoc}

string
getUrl()

Return the URL of the repository

array
getDist(string $identifier)

No description

array
getSource(string $identifier)

No description

string
getRootIdentifier()

Return the root identifier (trunk, master, default/tip .

array
getBranches()

Return list of branches in the repository

array
getTags()

Return list of tags in the repository

string
getApiUrl()

No description

string[]
getReferences(string $type)

No description

fetchProject()

No description

attemptCloneFallback()

No description

string
generateSshUrl()

Generate an SSH URL

generatePublicUrl()

No description

setupGitDriver($url)

No description

static bool
supports(IOInterface $io, Config $config, string $url, bool $deep = false)

Uses the config gitlab-domains to see if the driver supports the url for the repository given.

Details

final __construct(array $repoConfig, IOInterface $io, Config $config, ProcessExecutor $process = null, RemoteFilesystem $remoteFilesystem = null)

Constructor.

Parameters

array $repoConfig The repository configuration
IOInterface $io The IO instance
Config $config The composer configuration
ProcessExecutor $process Process instance, injectable for mocking
RemoteFilesystem $remoteFilesystem Remote Filesystem, injectable for mocking

protected bool shouldCache(string $identifier)

Returns whether or not the given $identifier should be cached or not.

Parameters

string $identifier

Return Value

bool

array getComposerInformation(string $identifier)

Return the composer.json file information

Parameters

string $identifier Any identifier to a specific branch/tag/commit

Return Value

array containing all infos from the composer.json file

protected getBaseComposerInformation($identifier)

Parameters

$identifier

bool hasComposerFile(string $identifier)

Return true if the repository has a composer file for a given identifier, false otherwise.

Parameters

string $identifier Any identifier to a specific branch/tag/commit

Return Value

bool Whether the repository has a composer file for a given identifier.

protected string getScheme()

Get the https or http protocol depending on SSL support.

Call this only if you know that the server supports both.

Return Value

string The correct type of protocol

protected mixed getContents(string $url, $fetchingRepoData = false)

Get the remote content.

Parameters

string $url The URL of content
$fetchingRepoData

Return Value

mixed The result

cleanup()

Performs any cleanup necessary as the driver is not longer needed

initialize()

Extracts information from the repository url.

SSH urls use https by default. Set "secure-http": false on the repository config to use http instead.

{@inheritDoc}

setRemoteFilesystem(RemoteFilesystem $remoteFilesystem)

Updates the RemoteFilesystem instance.

Mainly useful for tests.

Parameters

RemoteFilesystem $remoteFilesystem

string getFileContent(string $file, string $identifier)

Return the content of $file or null if the file does not exist.

Parameters

string $file
string $identifier

Return Value

string

DateTime getChangeDate(string $identifier)

Get the changedate for $identifier.

Parameters

string $identifier

Return Value

DateTime

getRepositoryUrl()

{@inheritDoc}

string getUrl()

Return the URL of the repository

Return Value

string

array getDist(string $identifier)

Parameters

string $identifier Any identifier to a specific branch/tag/commit

Return Value

array With type, url reference and shasum keys.

array getSource(string $identifier)

Parameters

string $identifier Any identifier to a specific branch/tag/commit

Return Value

array With type, url and reference keys.

string getRootIdentifier()

Return the root identifier (trunk, master, default/tip .

.)

Return Value

string Identifier

array getBranches()

Return list of branches in the repository

Return Value

array Branch names as keys, identifiers as values

array getTags()

Return list of tags in the repository

Return Value

array Tag names as keys, identifiers as values

string getApiUrl()

Return Value

string Base URL for GitLab API v3

protected string[] getReferences(string $type)

Parameters

string $type

Return Value

string[] where keys are named references like tags or branches and the value a sha

protected fetchProject()

protected attemptCloneFallback()

protected string generateSshUrl()

Generate an SSH URL

Return Value

string

protected generatePublicUrl()

protected setupGitDriver($url)

Parameters

$url

static bool supports(IOInterface $io, Config $config, string $url, bool $deep = false)

Uses the config gitlab-domains to see if the driver supports the url for the repository given.

{@inheritDoc}

Parameters

IOInterface $io IO instance
Config $config current $config
string $url URL to validate/check
bool $deep unless true, only shallow checks (url matching typically) should be done

Return Value

bool