HumHub Documentation (unofficial)

Loader
in package
implements LoaderInterface

Default implementation of Imagine\File\LoaderInterface.

Table of Contents

Interfaces

LoaderInterface
Interface for classes that can load local or remote files.

Constants

MINIMUM_CURL_VERSION  = '7.34.0'
The mimimum supported version of curl.

Properties

$data  : string|null
The loaded data.
$isCurlSupported  : bool|null
Is curl available, with a decent version?
$isUrl  : bool
Does $path contain an URL?
$path  : string
The file path.

Methods

__construct()  : mixed
Initialize the instance.
__toString()  : string
The string representation of this object must be the file path (local or remote).
getData()  : string
Get the file binary contents.
getPath()  : string
Get the path of the file (local or remote).
hasReadData()  : bool
Is the binary content already loaded?
isLocalFile()  : bool
Is this a local file.
checkLocalFile()  : mixed
Check that the file exists and it's readable.
isCurlSupported()  : bool
Check if curl is available and it's a decent version.
readLocalFile()  : string
Read a local file.
readRemoteFile()  : string
Read a remote file.
readRemoteFileWithCurl()  : string
Read a remote file using the cURL extension.
readRemoteFileWithFileGetContents()  : string
Read a remote file using the file_get_contents.
setCurlOptions()  : mixed
Set curl options.

Constants

MINIMUM_CURL_VERSION

The mimimum supported version of curl.

public string MINIMUM_CURL_VERSION = '7.34.0'

Properties

$data

The loaded data.

protected string|null $data

$isCurlSupported

Is curl available, with a decent version?

protected bool|null $isCurlSupported

$isUrl

Does $path contain an URL?

protected bool $isUrl

$path

The file path.

protected string $path

Methods

__construct()

Initialize the instance.

public __construct(string|mixed $path) : mixed
Parameters
$path : string|mixed

the file path (or an object whose string representation is the file path)

Tags
throws
InvalidArgumentException

throws an InvalidArgumentException is $path is an empty string, or is not an object that has a __toString method

__toString()

The string representation of this object must be the file path (local or remote).

public __toString() : string
Tags
see
LoaderInterface::__toString()
Return values
string

isCurlSupported()

Check if curl is available and it's a decent version.

protected isCurlSupported() : bool
Return values
bool

readRemoteFileWithCurl()

Read a remote file using the cURL extension.

protected readRemoteFileWithCurl() : string
Tags
throws
InvalidArgumentException
Return values
string

readRemoteFileWithFileGetContents()

Read a remote file using the file_get_contents.

protected readRemoteFileWithFileGetContents() : string
Tags
throws
InvalidArgumentException
Return values
string

setCurlOptions()

Set curl options.

protected setCurlOptions(resource $curl) : mixed
Parameters
$curl : resource
Tags
throws
RuntimeException

        
On this page

Search results