Zend\File\Transfer\Adapter\AbstractAdapter
Abstract class for file transfers (Downloads and Uploads)
This class needs a full rewrite. It re-implements functionality present in
Zend\Filter\Input and/or Zend\Form\Element, 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.
Synopsis
class AbstractAdapter
implements
TranslatorAwareInterface
{
- // constants
- const FILTER = 'FILTER';
- const VALIDATOR = 'VALIDATOR';
- // members
- protected array $break;
- protected FilterPluginManager $filterManager;
- protected array $filters;
- protected array $loaders;
- protected array $messages;
- protected TranslatorInterface $translator;
- protected bool $translatorEnabled;
- protected string $translatorTextDomain;
- protected ValidatorPluginManager $validatorManager;
- protected array $validators;
- protected array $files;
- protected string $tmpDir;
- protected array $options;
- // methods
- public abstract bool send()
- public abstract bool receive()
- public abstract bool isSent()
- public abstract bool isReceived()
- public abstract bool isUploaded()
- public abstract bool isFiltered()
- public AbstractAdapter setFilterManager()
- public FilterPluginManager getFilterManager()
- public AbstractAdapter setValidatorManager()
- public ValidatorPluginManager getValidatorManager()
- public AbstractAdapter addValidator()
- public AbstractAdapter addValidators()
- public AbstractAdapter setValidators()
- public bool hasValidator()
- public ValidatorInterface|null getValidator()
- public null|array getValidators()
- public AbstractAdapter removeValidator()
- public AbstractAdapter clearValidators()
- public AbstractAdapter setOptions()
- public array getOptions()
- public bool isValid()
- public array getMessages()
- public array getErrors()
- public bool hasErrors()
- public AbstractAdapter addFilter()
- public AbstractAdapter addFilters()
- public AbstractFilter setFilters()
- public bool hasFilter()
- public FilterInterface|null getFilter()
- public array getFilters()
- public AbstractAdapter removeFilter()
- public AbstractAdapter clearFilters()
- public string|array getFileName()
- public array getFileInfo()
- public AbstractAdapter setDestination()
- public null|string|array getDestination()
- public AbstractAdapter setTranslator()
- public Translator|null getTranslator()
- public bool hasTranslator()
- public AbstractAdapter setTranslatorEnabled()
- public bool isTranslatorEnabled()
- public AbstractAdapter setTranslatorTextDomain()
- public string getTranslatorTextDomain()
- public string|array getHash()
- public string|array getFileSize()
- protected string detectFileSize()
- public string|array getMimeType()
- protected string detectMimeType()
- protected static string toByteString()
- protected bool filter()
- protected string getTmpDir()
- protected bool isPathWriteable()
- protected array getFiles()
- protected string getValidatorIdentifier()
- protected string getFilterIdentifier()
Hierarchy
Extended by
Implements
Tasks
Line | Task |
---|---|
33+ | Rewrite |
Constants
Name | Value |
---|---|
FILTER | 'FILTER' |
VALIDATOR | 'VALIDATOR' |
Members
protected
- $break
—
array
Internal list of breaks - $files
—
array
Internal list of files This array looks like this: array(form => array( - Form is the name within the form or, if not set the filename name, - Original name of this file type, - Mime type of this file size, - Filesize in bytes tmp_name, - Internally temporary filename for uploaded files error, - Error which has occurred destination, - New destination for this file validators, - Set validator names for this file files - Set file names for this file )) - $filterManager — Zend\File\Transfer\Adapter\FilterPluginManager
- $filters
—
array
Internal list of filters - $loaders
—
array
Plugin loaders for filter and validation chains - $messages
—
array
Internal list of messages -
$options
Available options for file transfers - $tmpDir
—
string
TMP directory - $translator — Zend\I18n\Translator\TranslatorInterface
- $translatorEnabled
—
Zend\File\Transfer\Adapter\bool
Is translation enabled? - $translatorTextDomain
—
string
Translator text domain (optional) - $validatorManager — Zend\File\Transfer\Adapter\ValidatorPluginManager
- $validators
—
array
Internal list of validators
Methods
protected
- detectFileSize() — Internal method to detect the size of a file
- detectMimeType() — Internal method to detect the mime type of a file
- filter() — Internal function to filter all given files
- getFiles() — Returns found files based on internal file array and given files
- getFilterIdentifier() — Retrieve internal identifier for a named filter
- getTmpDir() — Determine system TMP directory and detect if we have read access
- getValidatorIdentifier() — Retrieve internal identifier for a named validator
- isPathWriteable() — Tries to detect if we can read and write to the given path
- toByteString() — Returns the formatted size
public
- addFilter() — Adds a new filter for this class
- addFilters() — Add Multiple filters at once
- addValidator() — Adds a new validator for this class
- addValidators() — Add Multiple validators at once
- clearFilters() — Remove all filters
- clearValidators() — Remove all validators
- getDestination() — Retrieve destination directory value
- getErrors() — Retrieve error codes
- getFileInfo() — Retrieve additional internal file informations for files
- getFileName() — Retrieves the filename of transferred files.
- getFileSize() — Returns the real filesize of the file
- getFilter() — Retrieve individual filter
- getFilterManager() — Get the filter plugin manager instance
- getFilters() — Returns all set filters
- getHash() — Returns the hash for a given file
- getMessages() — Returns found validation messages
- getMimeType() — Returns the real mimetype of the file Uses fileinfo, when not available mime_magic and as last fallback a manual given mimetype
- getOptions() — Returns set options for adapters or files
- getTranslator() — Retrieve localization translator object
- getTranslatorTextDomain() — Return the translation text domain
- getValidator() — Retrieve individual validator
- getValidatorManager() — Get the validator plugin manager instance
- getValidators() — Returns all set validators
- hasErrors() — Are there errors registered?
- hasFilter() — Determine if a given filter has already been registered
- hasTranslator() — Checks if the helper has a translator
- hasValidator() — Determine if a given validator has already been registered
- isFiltered() — Has the file been filtered ?
- isReceived() — Is file received?
- isSent() — Is file sent?
- isTranslatorEnabled() — Is translation enabled?
- isUploaded() — Has a file been uploaded ?
- isValid() — Checks if the files are valid
- receive() — Receive file
- removeFilter() — Remove an individual filter
- removeValidator() — Remove an individual validator
- send() — Send file
- setDestination() — Sets a new destination for the given files
- setFilterManager() — Set the filter plugin manager instance
- setFilters() — Sets a filter for the class, erasing all previous set
- setOptions() — Sets Options for adapters
- setTranslator() — Sets translator to use in helper
- setTranslatorEnabled() — Indicate whether or not translation should be enabled
- setTranslatorTextDomain() — Set translation text domain
- setValidatorManager() — Set the validator plugin manager instance
- setValidators() — Sets a validator for the class, erasing all previous set