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
__toString()
The string representation of this object must be the file path (local or remote).
public
__toString() : string
Tags
Return values
stringgetData()
Get the file binary contents.
public
getData() : string
Tags
Return values
stringgetPath()
Get the path of the file (local or remote).
public
getPath() : string
Tags
Return values
stringhasReadData()
Is the binary content already loaded?
public
hasReadData() : bool
Tags
Return values
boolisLocalFile()
Is this a local file.
public
isLocalFile() : bool
Tags
Return values
boolcheckLocalFile()
Check that the file exists and it's readable.
protected
checkLocalFile() : mixed
Tags
isCurlSupported()
Check if curl is available and it's a decent version.
protected
isCurlSupported() : bool
Return values
boolreadLocalFile()
Read a local file.
protected
readLocalFile() : string
Tags
Return values
stringreadRemoteFile()
Read a remote file.
protected
readRemoteFile() : string
Tags
Return values
stringreadRemoteFileWithCurl()
Read a remote file using the cURL extension.
protected
readRemoteFileWithCurl() : string
Tags
Return values
stringreadRemoteFileWithFileGetContents()
Read a remote file using the file_get_contents.
protected
readRemoteFileWithFileGetContents() : string
Tags
Return values
stringsetCurlOptions()
Set curl options.
protected
setCurlOptions(resource $curl) : mixed
Parameters
- $curl : resource