Constants

URL_REGEX

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

Properties

$url

$url : string

Type

string

$originUrl

$originUrl : string

Type

string

$repoConfig

$repoConfig : array

Type

array

$infoCache

$infoCache : array

Type

array

$portNumber

$portNumber : integer

Type

integer — port number

$scheme

$scheme : 

Type

$namespace

$namespace : 

Type

$repository

$repository : 

Type

$project

$project : array

Type

array — Project data returned by GitLab API

$commits

$commits : array

Type

array — Keeps commits returned by GitLab API

$tags

$tags : array

Type

array — List of tag => reference

$branches

$branches : array

Type

array — List of branch => reference

$isPrivate

$isPrivate : boolean

Defaults to true unless we can make sure it is public

Type

boolean — defines whether the repo is private or not

Methods

__construct()

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

Constructor.

Parameters

array $repoConfig

The repository configuration

\Composer\IO\IOInterface $io

The IO instance

\Composer\Config $config

The composer configuration

\Composer\Util\ProcessExecutor $process

Process instance, injectable for mocking

\Composer\Util\RemoteFilesystem $remoteFilesystem

Remote Filesystem, injectable for mocking

getComposerInformation()

getComposerInformation(string  $identifier) : array

Return the composer.json file information

Parameters

string $identifier

Any identifier to a specific branch/tag/commit

Returns

array —

containing all infos from the composer.json file

hasComposerFile()

hasComposerFile(string  $identifier) : boolean

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

Returns

boolean —

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

cleanup()

cleanup() 

Performs any cleanup necessary as the driver is not longer needed

initialize()

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}

getFileContent()

getFileContent(  $file,   $identifier) 

{@inheritdoc}

Parameters

$file
$identifier

getChangeDate()

getChangeDate(  $identifier) 

{@inheritdoc}

Parameters

$identifier

getRepositoryUrl()

getRepositoryUrl() 

{@inheritDoc}

getUrl()

getUrl() 

{@inheritDoc}

getDist()

getDist(  $identifier) 

{@inheritDoc}

Parameters

$identifier

getSource()

getSource(  $identifier) 

{@inheritDoc}

Parameters

$identifier

getRootIdentifier()

getRootIdentifier() 

{@inheritDoc}

getBranches()

getBranches() 

{@inheritDoc}

getTags()

getTags() 

{@inheritDoc}

getApiUrl()

getApiUrl() : string

Returns

string —

Base URL for GitLab API v3

supports()

supports(\Composer\IO\IOInterface  $io, \Composer\Config  $config,   $url,   $deep = false) 

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

{@inheritDoc}

Parameters

\Composer\IO\IOInterface $io
\Composer\Config $config
$url
$deep

shouldCache()

shouldCache(string  $identifier) : boolean

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

Parameters

string $identifier

Returns

boolean

getBaseComposerInformation()

getBaseComposerInformation(  $identifier) 

Parameters

$identifier

getScheme()

getScheme() : string

Get the https or http protocol depending on SSL support.

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

Returns

string —

The correct type of protocol

getContents()

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

Get the remote content.

Parameters

string $url

The URL of content

$fetchingRepoData

Returns

mixed —

The result

getReferences()

getReferences(string  $type) : array<mixed,string>

Parameters

string $type

Returns

array<mixed,string> —

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

fetchProject()

fetchProject() 

attemptCloneFallback()

attemptCloneFallback() 

generateSshUrl()

generateSshUrl() : string

Generate an SSH URL

Returns

string

generatePublicUrl()

generatePublicUrl() 

setupGitDriver()

setupGitDriver(  $url) 

Parameters

$url

urlEncodeAll()

urlEncodeAll(string  $string) : string

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

Parameters

string $string

Returns

string

getNextPage()

getNextPage() 

determineOrigin()

determineOrigin(array  $configuredDomains, string  $guessedDomain, array  $urlParts) : boolean|string

Parameters

array $configuredDomains
string $guessedDomain
array $urlParts

Returns

boolean|string