PHP Class FOF30\Download\Download

Exibir arquivo Open project: akeeba/fof Class Usage Examples

Protected Properties

Property Type Description
$container FOF30\Container\Container The component container object

Public Methods

Method Description
__construct ( Container $c ) Public constructor
getAdapterName ( ) : string Returns the name of the current adapter
getAdapterOptions ( ) : array Returns the additional options for the adapter
getFromURL ( string $url, integer $from = null, integer $to = null ) : boolean | string Download data from a URL and return it.
importFromURL ( array $params ) : array Performs the staggered download of file.
setAdapter ( string $className ) Forces the use of a specific adapter
setAdapterOptions ( array $options ) Sets the additional options for the adapter

Protected Methods

Method Description
getFiles ( string $path, array $ignoreFolders = [], array $ignoreFiles = [] ) : array This method will crawl a starting directory and get all the valid files that will be analyzed by __construct. Then it organizes them into an associative array.
scanDirectory ( string $path, array $ignoreFolders = [], array $ignoreFiles = [] ) : array Recursive function that will scan every directory unless it's in the ignore list. Files that aren't in the ignore list are returned.

Private Methods

Method Description
getParam ( string $key, mixed $default = null ) : mixed Used to decode the $params array

Method Details

__construct() public method

Public constructor
public __construct ( Container $c )
$c FOF30\Container\Container The component container

getAdapterName() public method

Returns the name of the current adapter
public getAdapterName ( ) : string
return string

getAdapterOptions() public method

Returns the additional options for the adapter
public getAdapterOptions ( ) : array
return array

getFiles() protected static method

This method will crawl a starting directory and get all the valid files that will be analyzed by __construct. Then it organizes them into an associative array.
protected static getFiles ( string $path, array $ignoreFolders = [], array $ignoreFiles = [] ) : array
$path string Folder where we should start looking
$ignoreFolders array Folder ignore list
$ignoreFiles array File ignore list
return array Associative array, where the `fullpath` key contains the path to the file, and the `classname` key contains the name of the class

getFromURL() public method

Important note about ranges: byte ranges start at 0. This means that the first 500 bytes of a file are from 0 to 499, NOT from 1 to 500. If you ask more bytes than there are in the file or a range which is invalid or does not exist this method will return false.
public getFromURL ( string $url, integer $from = null, integer $to = null ) : boolean | string
$url string The URL to download from
$from integer Byte range to start downloading from. Use null (default) for start of file.
$to integer Byte range to stop downloading. Use null to download the entire file ($from will be ignored!)
return boolean | string The downloaded data or false on failure

importFromURL() public method

Performs the staggered download of file.
public importFromURL ( array $params ) : array
$params array A parameters array, as sent by the user interface
return array A return status array

scanDirectory() protected static method

Recursive function that will scan every directory unless it's in the ignore list. Files that aren't in the ignore list are returned.
protected static scanDirectory ( string $path, array $ignoreFolders = [], array $ignoreFiles = [] ) : array
$path string Folder where we should start looking
$ignoreFolders array Folder ignore list
$ignoreFiles array File ignore list
return array List of all the files

setAdapter() public method

Forces the use of a specific adapter
public setAdapter ( string $className )
$className string The name of the class or the name of the adapter

setAdapterOptions() public method

Sets the additional options for the adapter
public setAdapterOptions ( array $options )
$options array

Property Details

$container protected_oe property

The component container object
protected Container,FOF30\Container $container
return FOF30\Container\Container