PHP Class FOF30\Download\Download

Afficher le fichier Open project: akeeba/fof Class Usage Examples

Protected Properties

Свойство Type Description
$container FOF30\Container\Container The component container object

Méthodes publiques

Méthode 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

Méthodes protégées

Méthode 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

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

Method Details

__construct() public méthode

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

getAdapterName() public méthode

Returns the name of the current adapter
public getAdapterName ( ) : string
Résultat string

getAdapterOptions() public méthode

Returns the additional options for the adapter
public getAdapterOptions ( ) : array
Résultat array

getFiles() protected static méthode

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
Résultat 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 méthode

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!)
Résultat boolean | string The downloaded data or false on failure

importFromURL() public méthode

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

scanDirectory() protected static méthode

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
Résultat array List of all the files

setAdapter() public méthode

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 méthode

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
Résultat FOF30\Container\Container