class RemoteFilesystem (View source)

Methods

__construct(IOInterface $io, Config $config = null, array $options = array(), bool $disableTls = false)

Constructor.

bool
copy(string $originUrl, string $fileUrl, string $fileName, bool $progress = true, array $options = array())

Copy the remote file in local.

bool|string
getContents(string $originUrl, string $fileUrl, bool $progress = true, array $options = array())

Get the content.

array
getOptions()

Retrieve the options set in the constructor

setOptions(array $options)

Merges new options

bool
isTlsDisabled()

Check is disable TLS.

array
getLastHeaders()

Returns the headers of the last request

string|null
findHeaderValue(array $headers, string $name)

No description

int|null
findStatusCode(array $headers)

No description

string|null
findStatusMessage(array $headers)

No description

bool|string
get(string $originUrl, string $fileUrl, array $additionalOptions = array(), string $fileName = null, bool $progress = true)

Get file content or copy action.

string|false
getRemoteContents($originUrl, $fileUrl, $context, array $responseHeaders = null)

Get contents of remote URL.

callbackGet(int $notificationCode, int $severity, string $message, int $messageCode, int $bytesTransferred, int $bytesMax)

Get notification action.

promptAuthAndRetry($httpStatus, $reason = null, $warning = null, $headers = array())

No description

getOptionsForUrl($originUrl, $additionalOptions)

No description

Details

__construct(IOInterface $io, Config $config = null, array $options = array(), bool $disableTls = false)

Constructor.

Parameters

IOInterface $io The IO instance
Config $config The config
array $options The options
bool $disableTls

bool copy(string $originUrl, string $fileUrl, string $fileName, bool $progress = true, array $options = array())

Copy the remote file in local.

Parameters

string $originUrl The origin URL
string $fileUrl The file URL
string $fileName the local filename
bool $progress Display the progression
array $options Additional context options

Return Value

bool true

bool|string getContents(string $originUrl, string $fileUrl, bool $progress = true, array $options = array())

Get the content.

Parameters

string $originUrl The origin URL
string $fileUrl The file URL
bool $progress Display the progression
array $options Additional context options

Return Value

bool|string The content

array getOptions()

Retrieve the options set in the constructor

Return Value

array Options

setOptions(array $options)

Merges new options

Parameters

array $options

bool isTlsDisabled()

Check is disable TLS.

Return Value

bool

array getLastHeaders()

Returns the headers of the last request

Return Value

array

string|null findHeaderValue(array $headers, string $name)

Parameters

array $headers array of returned headers like from getLastHeaders()
string $name header name (case insensitive)

Return Value

string|null

int|null findStatusCode(array $headers)

Parameters

array $headers array of returned headers like from getLastHeaders()

Return Value

int|null

string|null findStatusMessage(array $headers)

Parameters

array $headers array of returned headers like from getLastHeaders()

Return Value

string|null

protected bool|string get(string $originUrl, string $fileUrl, array $additionalOptions = array(), string $fileName = null, bool $progress = true)

Get file content or copy action.

Parameters

string $originUrl The origin URL
string $fileUrl The file URL
array $additionalOptions context options
string $fileName the local filename
bool $progress Display the progression

Return Value

bool|string

Exceptions

Exception
TransportException When the file could not be downloaded

protected string|false getRemoteContents($originUrl, $fileUrl, $context, array $responseHeaders = null)

Get contents of remote URL.

Parameters

$originUrl
$fileUrl
$context
array $responseHeaders

Return Value

string|false The response contents or false on failure

protected callbackGet(int $notificationCode, int $severity, string $message, int $messageCode, int $bytesTransferred, int $bytesMax)

Get notification action.

Parameters

int $notificationCode The notification code
int $severity The severity level
string $message The message
int $messageCode The message code
int $bytesTransferred The loaded size
int $bytesMax The total size

Exceptions

TransportException

protected promptAuthAndRetry($httpStatus, $reason = null, $warning = null, $headers = array())

Parameters

$httpStatus
$reason
$warning
$headers

protected getOptionsForUrl($originUrl, $additionalOptions)

Parameters

$originUrl
$additionalOptions