Zend Framework
3.0
|
Abstract class for file transfers (Downloads and Uploads) More...
Public Member Functions | |
send ($options=null) | |
Send file. | |
receive ($options=null) | |
Receive file. | |
isSent ($files=null) | |
Is file sent? | |
isReceived ($files=null) | |
Is file received? | |
isUploaded ($files=null) | |
Has a file been uploaded ? | |
isFiltered ($files=null) | |
Has the file been filtered ? | |
setFilterManager (FilterPluginManager $filterManager) | |
Adds one or more files. | |
getFilterManager () | |
Get the filter plugin manager instance. | |
setValidatorManager (ValidatorPluginManager $validatorManager) | |
Set the validator plugin manager instance. | |
getValidatorManager () | |
Get the validator plugin manager instance. | |
addValidator ($validator, $breakChainOnFailure=false, $options=null, $files=null) | |
Adds a new validator for this class. | |
addValidators (array $validators, $files=null) | |
Add Multiple validators at once. | |
setValidators (array $validators, $files=null) | |
Sets a validator for the class, erasing all previous set. | |
hasValidator ($name) | |
Determine if a given validator has already been registered. | |
getValidator ($name) | |
Retrieve individual validator. | |
getValidators ($files=null) | |
Returns all set validators. | |
removeValidator ($name) | |
Remove an individual validator. | |
clearValidators () | |
Remove all validators. | |
setOptions ($options=[], $files=null) | |
Sets Options for adapters. | |
getOptions ($files=null) | |
Returns set options for adapters or files. | |
isValid ($files=null) | |
Checks if the files are valid. | |
getMessages () | |
Returns found validation messages. | |
getErrors () | |
Retrieve error codes. | |
hasErrors () | |
Are there errors registered? | |
addFilter ($filter, $options=null, $files=null) | |
Adds a new filter for this class. | |
addFilters (array $filters, $files=null) | |
Add Multiple filters at once. | |
setFilters (array $filters, $files=null) | |
Sets a filter for the class, erasing all previous set. | |
hasFilter ($name) | |
Determine if a given filter has already been registered. | |
getFilter ($name) | |
Retrieve individual filter. | |
getFilters ($files=null) | |
Returns all set filters. | |
removeFilter ($name) | |
Remove an individual filter. | |
clearFilters () | |
Remove all filters. | |
getFileName ($file=null, $path=true) | |
Retrieves the filename of transferred files. | |
getFileInfo ($file=null) | |
Retrieve additional internal file informations for files. | |
setDestination ($destination, $files=null) | |
Sets a new destination for the given files. | |
getDestination ($files=null) | |
Retrieve destination directory value. | |
setTranslator (Translator $translator=null, $textDomain=null) | |
Sets translator to use in helper. | |
getTranslator () | |
Retrieve localization translator object. | |
hasTranslator () | |
Checks if the helper has a translator. | |
setTranslatorEnabled ($flag=true) | |
Indicate whether or not translation should be enabled. | |
isTranslatorEnabled () | |
Is translation enabled? | |
setTranslatorTextDomain ($textDomain= 'default') | |
Set translation text domain. | |
getTranslatorTextDomain () | |
Return the translation text domain. | |
getHash ($hash= 'crc32', $files=null) | |
Returns the hash for a given file. | |
getFileSize ($files=null) | |
Returns the real filesize of the file. | |
getMimeType ($files=null) | |
Returns the real mimetype of the file Uses fileinfo, when not available mime_magic and as last fallback a manual given mimetype. | |
Public Member Functions inherited from TranslatorAwareInterface | |
setTranslator (TranslatorInterface $translator=null, $textDomain=null) | |
Sets translator to use in helper. | |
Public Attributes | |
const | FILTER = 'FILTER' |
@+ Plugin loader Constants | |
const | VALIDATOR = 'VALIDATOR' |
Protected Member Functions | |
detectFileSize ($value) | |
Internal method to detect the size of a file. | |
detectMimeType ($value) | |
Internal method to detect the mime type of a file. | |
filter ($files=null) | |
Internal function to filter all given files. | |
getTmpDir () | |
Determine system TMP directory and detect if we have read access. | |
isPathWriteable ($path) | |
Tries to detect if we can read and write to the given path. | |
getFiles ($files, $names=false, $noexception=false) | |
Returns found files based on internal file array and given files. | |
getValidatorIdentifier ($name) | |
Retrieve internal identifier for a named validator. | |
getFilterIdentifier ($name) | |
Retrieve internal identifier for a named filter. | |
Static Protected Member Functions | |
static | toByteString ($size) |
Returns the formatted size. | |
Protected Attributes | |
$break = [] | |
$filterManager | |
$filters = [] | |
$loaders = [] | |
$messages = [] | |
$translator | |
$translatorEnabled = true | |
$translatorTextDomain = 'default' | |
$validatorManager | |
$validators = [] | |
$files = [] | |
$tmpDir | |
$options | |
Available options for file transfers. | |
Abstract class for file transfers (Downloads and Uploads)
This class needs a full rewrite. It re-implements functionality present in Zend and/or Zend, and in a way that's inconsistent with either one. Additionally, plugin loader usage is now deprecated – but modifying that should be done in tandem with a rewrite to utilize validator and filter chains instead.
addFilter | ( | $filter, | |
$options = null , |
|||
$files = null |
|||
) |
Adds a new filter for this class.
string | Filter\FilterInterface | $filter | Type of filter to add |
string | array | $options | Options to set for the filter |
string | array | $files | Files to limit this filter to |
Exception\InvalidArgumentException | for invalid type |
addFilters | ( | array | $filters, |
$files = null |
|||
) |
addValidator | ( | $validator, | |
$breakChainOnFailure = false , |
|||
$options = null , |
|||
$files = null |
|||
) |
Adds a new validator for this class.
string | Validator\ValidatorInterface | $validator | Type of validator to add |
bool | $breakChainOnFailure | If the validation chain should stop a failure |
string | array | $options | Options to set for the validator |
string | array | $files | Files to limit this validator to |
Exception\InvalidArgumentException | for invalid type |
addValidators | ( | array | $validators, |
$files = null |
|||
) |
Add Multiple validators at once.
array | $validators | |
string | array | $files |
Exception\InvalidArgumentException | for invalid type |
clearFilters | ( | ) |
Remove all filters.
clearValidators | ( | ) |
Remove all validators.
|
protected |
Internal method to detect the size of a file.
array | $value | File infos |
|
protected |
Internal method to detect the mime type of a file.
array | $value | File infos |
|
protected |
Internal function to filter all given files.
string | array | $files | (Optional) Files to check |
getDestination | ( | $files = null | ) |
Retrieve destination directory value.
null | string | array | $files |
Exception\InvalidArgumentException |
getErrors | ( | ) |
Retrieve error codes.
getFileInfo | ( | $file = null | ) |
Retrieve additional internal file informations for files.
string | $file | (Optional) File to get informations for |
getFileName | ( | $file = null , |
|
$path = true |
|||
) |
Retrieves the filename of transferred files.
string | $file | (Optional) Element to return the filename for |
bool | $path | (Optional) Should the path also be returned ? |
|
protected |
Returns found files based on internal file array and given files.
string | array | $files | (Optional) Files to return |
bool | $names | (Optional) Returns only names on true, else complete info |
bool | $noexception | (Optional) Allows throwing an exception, otherwise returns an empty array |
Exception\RuntimeException | On false filename |
getFileSize | ( | $files = null | ) |
Returns the real filesize of the file.
string | array | $files | Files to get the filesize from |
Exception\InvalidArgumentException | When the file does not exist |
getFilter | ( | $name | ) |
|
protected |
Retrieve internal identifier for a named filter.
string | $name |
getFilterManager | ( | ) |
Get the filter plugin manager instance.
getFilters | ( | $files = null | ) |
Returns all set filters.
string | array | $files | (Optional) Returns the filter for this files |
Exception\RuntimeException | When file not found |
getHash | ( | $hash = 'crc32' , |
|
$files = null |
|||
) |
Returns the hash for a given file.
string | $hash | Hash algorithm to use |
string | array | $files | Files to return the hash for |
Exception\InvalidArgumentException | On unknown hash algorithm |
getMessages | ( | ) |
Returns found validation messages.
getMimeType | ( | $files = null | ) |
Returns the real mimetype of the file Uses fileinfo, when not available mime_magic and as last fallback a manual given mimetype.
string | array | $files | Files to get the mimetype from |
Exception\InvalidArgumentException | When the file does not exist |
getOptions | ( | $files = null | ) |
Returns set options for adapters or files.
array | $files | (Optional) Files to return the options for |
|
protected |
Determine system TMP directory and detect if we have read access.
Exception\RuntimeException | if unable to determine directory |
getTranslator | ( | ) |
Retrieve localization translator object.
Implements TranslatorAwareInterface.
getTranslatorTextDomain | ( | ) |
getValidator | ( | $name | ) |
|
protected |
Retrieve internal identifier for a named validator.
string | $name |
getValidatorManager | ( | ) |
Get the validator plugin manager instance.
getValidators | ( | $files = null | ) |
Returns all set validators.
string | array | $files | (Optional) Returns the validator for this files |
hasErrors | ( | ) |
Are there errors registered?
hasFilter | ( | $name | ) |
Determine if a given filter has already been registered.
string | $name |
hasTranslator | ( | ) |
hasValidator | ( | $name | ) |
Determine if a given validator has already been registered.
string | $name |
|
abstract |
Has the file been filtered ?
array | string | null | $files |
|
protected |
Tries to detect if we can read and write to the given path.
string | $path |
|
abstract |
Is file received?
array | string | null | $files |
|
abstract |
Is file sent?
array | string | null | $files |
isTranslatorEnabled | ( | ) |
|
abstract |
Has a file been uploaded ?
array | string | null | $files |
isValid | ( | $files = null | ) |
Checks if the files are valid.
string | array | $files | (Optional) Files to check |
|
abstract |
Receive file.
mixed | $options |
removeFilter | ( | $name | ) |
removeValidator | ( | $name | ) |
|
abstract |
Send file.
mixed | $options |
setDestination | ( | $destination, | |
$files = null |
|||
) |
Sets a new destination for the given files.
string | $destination | New destination directory |
string | array | $files | Files to set the new destination for |
Exception\InvalidArgumentException | when the given destination is not a directory or does not exist |
setFilterManager | ( | FilterPluginManager | $filterManager | ) |
Adds one or more files.
string | array | $file | File to add |
string | array | $validator | Validators to use for this file, must be set before |
string | array | $filter | Filters to use for this file, must be set before |
Exception | Not implemented Returns all set types |
Exception | Not implemented Adds one or more type of files |
string | array | $type | Type of files to add |
string | array | $validator | Validators to use for this file, must be set before |
string | array | $filter | Filters to use for this file, must be set before |
Exception | Not implemented Returns all set files |
FilterPluginManager | $filterManager |
setFilters | ( | array | $filters, |
$files = null |
|||
) |
setOptions | ( | $options = [] , |
|
$files = null |
|||
) |
Sets Options for adapters.
array | $options | Options to set |
array | $files | (Optional) Files to set the options for |
setTranslator | ( | Translator | $translator = null , |
$textDomain = null |
|||
) |
Sets translator to use in helper.
Translator | $translator | [optional] translator. Default is null, which sets no translator. |
string | $textDomain | [optional] text domain Default is null, which skips setTranslatorTextDomain |
setTranslatorEnabled | ( | $flag = true | ) |
Indicate whether or not translation should be enabled.
bool | $flag |
Implements TranslatorAwareInterface.
setTranslatorTextDomain | ( | $textDomain = 'default' | ) |
Set translation text domain.
string | $textDomain |
Implements TranslatorAwareInterface.
setValidatorManager | ( | ValidatorPluginManager | $validatorManager | ) |
Set the validator plugin manager instance.
ValidatorPluginManager | $validatorManager |
setValidators | ( | array | $validators, |
$files = null |
|||
) |
Sets a validator for the class, erasing all previous set.
array | $validators | Validators to set |
string | array | $files | Files to limit this validator to |
|
staticprotected |
Returns the formatted size.
int | $size |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
Available options for file transfers.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
const FILTER = 'FILTER' |
@+ Plugin loader Constants
const VALIDATOR = 'VALIDATOR' |