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

array
setOptions(array $options)

Merges new options

isTlsDisabled()

No description

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

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

Get file content or copy action.

array
getRemoteContents(string $originUrl, string $fileUrl, resource $context)

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)

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

array setOptions(array $options)

Merges new options

Parameters

array $options

Return Value

array $options

isTlsDisabled()

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

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 array getRemoteContents(string $originUrl, string $fileUrl, resource $context)

Get contents of remote URL.

Parameters

string $originUrl The origin URL
string $fileUrl The file URL
resource $context The stream context

Return Value

array The response headers and the contents

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)

Parameters

$httpStatus
$reason

protected getOptionsForUrl($originUrl, $additionalOptions)

Parameters

$originUrl
$additionalOptions