Documentation

GitLabDriver extends VcsDriver
in package

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

Tags
author

Henrik Bjørnskov henrik@bjrnskov.dk

author

Jérôme Tamarelle jerome@tamarelle.net

Table of Contents

URL_REGEX  = '#^(?:(?P<scheme>https?)://(?P<domain>.+?)(?::(?P<port>[0-9]+))?/|git@(?P<domain2>[^:]+):)(?P<parts>.+)/(?P<repo>[^/]+?)(?:\.git|/)?$#'
$cache  : Cache
$config  : Config
$gitDriver  : GitDriver
Git Driver
$infoCache  : array<string|int, mixed>
$io  : IOInterface
$originUrl  : string
$process  : ProcessExecutor
$remoteFilesystem  : RemoteFilesystem
$repoConfig  : array<string|int, mixed>
$url  : string
$branches  : array<string|int, mixed>
$commits  : array<string|int, mixed>
$hasNonstandardOrigin  : bool
$isPrivate  : bool
Defaults to true unless we can make sure it is public
$namespace  : mixed
$project  : array<string|int, mixed>
$repository  : mixed
$scheme  : mixed
$tags  : array<string|int, mixed>
__construct()  : mixed
Constructor.
cleanup()  : mixed
Performs any cleanup necessary as the driver is not longer needed
getApiUrl()  : string
getBranches()  : mixed
{@inheritDoc}
getChangeDate()  : mixed
{@inheritdoc}
getComposerInformation()  : array<string|int, mixed>
Return the composer.json file information
getDist()  : mixed
{@inheritDoc}
getFileContent()  : mixed
{@inheritdoc}
getRepositoryUrl()  : mixed
{@inheritDoc}
getRootIdentifier()  : mixed
{@inheritDoc}
getSource()  : mixed
{@inheritDoc}
getTags()  : mixed
{@inheritDoc}
getUrl()  : mixed
{@inheritDoc}
hasComposerFile()  : bool
Return true if the repository has a composer file for a given identifier, false otherwise.
initialize()  : mixed
Extracts information from the repository url.
supports()  : mixed
Uses the config `gitlab-domains` to see if the driver supports the url for the repository given.
attemptCloneFallback()  : mixed
fetchProject()  : mixed
generatePublicUrl()  : mixed
generateSshUrl()  : string
Generate an SSH URL
getBaseComposerInformation()  : mixed
getContents()  : mixed
Get the remote content.
getReferences()  : array<string|int, string>
getScheme()  : string
Get the https or http protocol depending on SSL support.
setupGitDriver()  : mixed
shouldCache()  : bool
Returns whether or not the given $identifier should be cached or not.
determineOrigin()  : bool|string
getNextPage()  : mixed
urlEncodeAll()  : string
Urlencode all non alphanumeric characters. rawurlencode() can not be used as it does not encode `.`

Constants

URL_REGEX

public mixed URL_REGEX = '#^(?:(?P<scheme>https?)://(?P<domain>.+?)(?::(?P<port>[0-9]+))?/|git@(?P<domain2>[^:]+):)(?P<parts>.+)/(?P<repo>[^/]+?)(?:\.git|/)?$#'

Properties

$infoCache

protected array<string|int, mixed> $infoCache = array()

$repoConfig

protected array<string|int, mixed> $repoConfig

$branches

private array<string|int, mixed> $branches

List of branch => reference

$commits

private array<string|int, mixed> $commits = array()

Keeps commits returned by GitLab API

$hasNonstandardOrigin

private bool $hasNonstandardOrigin = false

true if the origin has a port number or a path component in it

$isPrivate

Defaults to true unless we can make sure it is public

private bool $isPrivate = true

defines whether the repo is private or not

$project

private array<string|int, mixed> $project

Project data returned by GitLab API

$tags

private array<string|int, mixed> $tags

List of tag => reference

Methods

__construct()

Constructor.

public final __construct(array<string|int, mixed> $repoConfig, IOInterface $io, Config $config[, ProcessExecutor $process = null ][, RemoteFilesystem $remoteFilesystem = null ]) : mixed
Parameters
$repoConfig : array<string|int, mixed>

The repository configuration

$io : IOInterface

The IO instance

$config : Config

The composer configuration

$process : ProcessExecutor = null

Process instance, injectable for mocking

$remoteFilesystem : RemoteFilesystem = null

Remote Filesystem, injectable for mocking

Return values
mixed

cleanup()

Performs any cleanup necessary as the driver is not longer needed

public cleanup() : mixed
Return values
mixed

getApiUrl()

public getApiUrl() : string
Return values
string

Base URL for GitLab API v3

getBranches()

{@inheritDoc}

public getBranches() : mixed
Return values
mixed

getChangeDate()

{@inheritdoc}

public getChangeDate(mixed $identifier) : mixed
Parameters
$identifier : mixed
Return values
mixed

getComposerInformation()

Return the composer.json file information

public getComposerInformation(mixed $identifier) : array<string|int, mixed>
Parameters
$identifier : mixed

Any identifier to a specific branch/tag/commit

Return values
array<string|int, mixed>

containing all infos from the composer.json file

getDist()

{@inheritDoc}

public getDist(mixed $identifier) : mixed
Parameters
$identifier : mixed
Return values
mixed

getFileContent()

{@inheritdoc}

public getFileContent(mixed $file, mixed $identifier) : mixed
Parameters
$file : mixed
$identifier : mixed
Return values
mixed

getRepositoryUrl()

{@inheritDoc}

public getRepositoryUrl() : mixed
Return values
mixed

getRootIdentifier()

{@inheritDoc}

public getRootIdentifier() : mixed
Return values
mixed

getSource()

{@inheritDoc}

public getSource(mixed $identifier) : mixed
Parameters
$identifier : mixed
Return values
mixed

getTags()

{@inheritDoc}

public getTags() : mixed
Return values
mixed

getUrl()

{@inheritDoc}

public getUrl() : mixed
Return values
mixed

hasComposerFile()

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

public hasComposerFile(mixed $identifier) : bool
Parameters
$identifier : mixed

Any identifier to a specific branch/tag/commit

Return values
bool

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

initialize()

Extracts information from the repository url.

public initialize() : mixed

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

Return values
mixed

supports()

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

public static supports(IOInterface $io, Config $config, mixed $url[, mixed $deep = false ]) : mixed
Parameters
$io : IOInterface
$config : Config
$url : mixed
$deep : mixed = false
Return values
mixed

attemptCloneFallback()

protected attemptCloneFallback() : mixed
Return values
mixed

fetchProject()

protected fetchProject() : mixed
Return values
mixed

generatePublicUrl()

protected generatePublicUrl() : mixed
Return values
mixed

generateSshUrl()

Generate an SSH URL

protected generateSshUrl() : string
Return values
string

getBaseComposerInformation()

protected getBaseComposerInformation(mixed $identifier) : mixed
Parameters
$identifier : mixed
Return values
mixed

getContents()

Get the remote content.

protected getContents(mixed $url[, mixed $fetchingRepoData = false ]) : mixed
Parameters
$url : mixed

The URL of content

$fetchingRepoData : mixed = false
Return values
mixed

The result

getReferences()

protected getReferences(string $type) : array<string|int, string>
Parameters
$type : string
Return values
array<string|int, string>

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

getScheme()

Get the https or http protocol depending on SSL support.

protected getScheme() : string

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

Return values
string

The correct type of protocol

setupGitDriver()

protected setupGitDriver(mixed $url) : mixed
Parameters
$url : mixed
Return values
mixed

shouldCache()

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

protected shouldCache(string $identifier) : bool
Parameters
$identifier : string
Return values
bool

determineOrigin()

private static determineOrigin(array<string|int, mixed> $configuredDomains, string $guessedDomain, array<string|int, mixed> &$urlParts, mixed $portNumber) : bool|string
Parameters
$configuredDomains : array<string|int, mixed>
$guessedDomain : string
$urlParts : array<string|int, mixed>
$portNumber : mixed
Return values
bool|string

getNextPage()

private getNextPage() : mixed
Return values
mixed

urlEncodeAll()

Urlencode all non alphanumeric characters. rawurlencode() can not be used as it does not encode `.`

private urlEncodeAll(string $string) : string
Parameters
$string : string
Return values
string

Search results