PHP Класс FOF30\Download\Download

Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$container FOF30\Container\Container The component container object

Открытые методы

Метод Описание
__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

Защищенные методы

Метод Описание
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.

Приватные методы

Метод Описание
getParam ( string $key, mixed $default = null ) : mixed Used to decode the $params array

Описание методов

__construct() публичный Метод

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

getAdapterName() публичный Метод

Returns the name of the current adapter
public getAdapterName ( ) : string
Результат string

getAdapterOptions() публичный Метод

Returns the additional options for the adapter
public getAdapterOptions ( ) : array
Результат array

getFiles() защищенный статический Метод

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
Результат array Associative array, where the `fullpath` key contains the path to the file, and the `classname` key contains the name of the class

getFromURL() публичный Метод

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!)
Результат boolean | string The downloaded data or false on failure

importFromURL() публичный Метод

Performs the staggered download of file.
public importFromURL ( array $params ) : array
$params array A parameters array, as sent by the user interface
Результат array A return status array

scanDirectory() защищенный статический Метод

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
Результат array List of all the files

setAdapter() публичный Метод

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() публичный Метод

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

Описание свойств

$container защищенное свойство

The component container object
protected Container,FOF30\Container $container
Результат FOF30\Container\Container