class GitHub (View source)

Properties

protected $io
protected $config
protected $process
protected $remoteFilesystem

Methods

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

Constructor.

bool
authorizeOAuth(string $originUrl)

Attempts to authorize a GitHub domain via OAuth

bool
authorizeOAuthInteractively(string $originUrl, string $message = null)

Authorizes a GitHub domain interactively via OAuth

array
getRateLimit(array $headers)

Extract ratelimit from response.

bool
isRateLimited(array $headers)

Finds whether a request failed due to rate limiting

Details

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

Constructor.

Parameters

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

bool authorizeOAuth(string $originUrl)

Attempts to authorize a GitHub domain via OAuth

Parameters

string $originUrl The host this GitHub instance is located at

Return Value

bool true on success

bool authorizeOAuthInteractively(string $originUrl, string $message = null)

Authorizes a GitHub domain interactively via OAuth

Parameters

string $originUrl The host this GitHub instance is located at
string $message The reason this authorization is required

Return Value

bool true on success

Exceptions

RuntimeException
Exception

array getRateLimit(array $headers)

Extract ratelimit from response.

Parameters

array $headers Headers from Composer\Downloader\TransportException.

Return Value

array Associative array with the keys limit and reset.

bool isRateLimited(array $headers)

Finds whether a request failed due to rate limiting

Parameters

array $headers Headers from Composer\Downloader\TransportException.

Return Value

bool