The remote_resource class.
More...
|
curl | $curl |
| $curl the curl http helper.
|
|
string | $extension |
| $extension the file extension of this remote file.
|
|
string | $filename |
| $filename the name of this remote file.
|
|
array | $headinfo = [] |
| $headinfo the array of information for the most recent HEAD request.
|
|
stdClass | $metadata |
| $metadata information about the resource.
|
|
url | $url |
| $url the url to the remote resource.
|
|
The remote_resource class.
Objects of type remote_resource provide a means of interacting with resources over HTTP.
- Copyright
- 2020 Jake Dallimore jrhda.nosp@m.llim.nosp@m.ore@g.nosp@m.mail.nosp@m..com
- License
- http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
◆ __construct()
tool_moodlenet\local\remote_resource::__construct |
( |
\curl |
$curl, |
|
|
url |
$url, |
|
|
stdClass |
$metadata |
|
) |
| |
The remote_resource constructor.
- Parameters
-
curl | $curl | a curl object for HTTP requests. |
url | $url | the URL of the remote resource. |
stdClass | $metadata | resource metadata such as name, summary, license, etc. |
◆ download_to_requestdir()
tool_moodlenet\local\remote_resource::download_to_requestdir |
( |
| ) |
|
Download the remote resource to a local requestdir, returning the path and name of the resulting file.
- Return values
-
array | an array containing filepath adn filename, e.g. [filepath, filename]. |
- Exceptions
-
◆ get_description()
tool_moodlenet\local\remote_resource::get_description |
( |
| ) |
|
Get the description of the resource as taken from the metadata.
- Return values
-
◆ get_download_size()
tool_moodlenet\local\remote_resource::get_download_size |
( |
| ) |
|
Returns the file size of the remote file, in bytes, or null if it cannot be determined.
- Return values
-
int|null | the content length, if able to be determined, otherwise null. |
◆ get_extension()
tool_moodlenet\local\remote_resource::get_extension |
( |
| ) |
|
Return the extension of the file, if found.
- Return values
-
string | the extension of the file, if found. |
◆ get_metadata()
tool_moodlenet\local\remote_resource::get_metadata |
( |
| ) |
|
Get the resource metadata.
- Return values
-
◆ get_resource_info()
tool_moodlenet\local\remote_resource::get_resource_info |
( |
| ) |
|
|
protected |
Fetches information about the remote resource via a HEAD request.
- Exceptions
-
◆ get_url()
tool_moodlenet\local\remote_resource::get_url |
( |
| ) |
|
Return the URL for this remote resource.
- Return values
-
The documentation for this class was generated from the following file: