Zend\Validator\File\FilesSize
Validator for the size of all files which will be validated in sum
Synopsis
class FilesSize
extends Size
{
- // constants
- const TOO_BIG = 'fileFilesSizeTooBig';
- const TOO_SMALL = 'fileFilesSizeTooSmall';
- const NOT_READABLE = 'fileFilesSizeNotReadable';
- // Inherited constants from Size
- const TOO_BIG = 'fileSizeTooBig';
- const TOO_SMALL = 'fileSizeTooSmall';
- const NOT_FOUND = 'fileSizeNotFound';
- // members
- protected array $messageTemplates;
- protected array $files;
- // Inherited members from Size
- protected array $messageTemplates;
- protected array $messageVariables;
- protected int $size;
- protected array $options;
- // Inherited members from AbstractValidator
- protected mixed $value;
- protected TranslatorInterface $defaultTranslator;
- protected string $defaultTranslatorTextDomain;
- protected integer $messageLength;
- protected array $abstractOptions;
- // methods
- public void __construct()
- public bool isValid()
- protected false throwError()
- // Inherited methods from Size
- public void __construct()
- public int useByteString()
- public bool getByteString()
- public int|string getMin()
- public Size setMin()
- public int|string getMax()
- public Size setMax()
- protected int getSize()
- protected Size setSize()
- public bool isValid()
- protected string toByteString()
- protected int fromByteString()
- // Inherited methods from AbstractValidator
- public void __construct()
- public mixed getOption()
- public array getOptions()
- public AbstractValidator setOptions()
- public array getMessages()
- public bool __invoke()
- public array getMessageVariables()
- public array getMessageTemplates()
- public AbstractValidator setMessage()
- public AbstractValidator setMessages()
- public mixed __get()
- protected string createMessage()
- protected void error()
- protected mixed getValue()
- protected void setValue()
- public AbstractValidator setValueObscured()
- public bool isValueObscured()
- public AbstractValidator setTranslator()
- public TranslatorInterface|null getTranslator()
- public bool hasTranslator()
- public AbstractValidator setTranslatorTextDomain()
- public string getTranslatorTextDomain()
- public static void setDefaultTranslator()
- public static TranslatorInterface|null getDefaultTranslator()
- public static bool hasDefaultTranslator()
- public static void setDefaultTranslatorTextDomain()
- public static string getDefaultTranslatorTextDomain()
- public AbstractValidator setTranslatorEnabled()
- public bool isTranslatorEnabled()
- public static int getMessageLength()
- public static void setMessageLength()
- protected string translateMessage()
Hierarchy
Extends
Constants
Name | Value |
---|---|
TOO_BIG | 'fileFilesSizeTooBig' |
TOO_SMALL | 'fileFilesSizeTooSmall' |
NOT_READABLE | 'fileFilesSizeNotReadable' |
TOO_BIG | 'fileSizeTooBig' |
TOO_SMALL | 'fileSizeTooSmall' |
NOT_FOUND | 'fileSizeNotFound' |
Members
protected
- $abstractOptions
- $defaultTranslator
—
Zend\Validator\Translator\TranslatorInterface
Default translation object for all validate objects - $defaultTranslatorTextDomain
—
string
Default text domain to be used with translator - $files
—
array
Internal file array - $messageLength
—
int
Limits the maximum returned length of an error message - $messageTemplates — array
- $messageTemplates — array
- $messageVariables — array
- $options
—
array
Options for this validator - $size
—
int
Detected size - $value
—
mixed
The value to be validated
Methods
protected
- throwError() — Throws an error of the given type
public
- __construct() — Sets validator options
- isValid() — Returns true if and only if the disk usage of all files is at least min and not bigger than max (when max is not null).
Inherited from Zend\Validator\File\Size
protected
- fromByteString() — Returns the unformatted size
- getSize() — Retrieve current detected file size
- setSize() — Set current size
- toByteString() — Returns the formatted size
public
- getByteString() — Will bytestring be used?
- getMax() — Returns the maximum file size
- getMin() — Returns the minimum file size
- isValid() — Returns true if and only if the file size of $value is at least min and not bigger than max (when max is not null).
- setMax() — Sets the maximum file size
- setMin() — Sets the minimum file size
- useByteString() — Should messages return bytes as integer or as string in SI notation
Inherited from Zend\Validator\AbstractValidator
protected
- createMessage() — Constructs and returns a validation failure message with the given message key and value.
- error()
- getValue() — Returns the validation value
- setValue() — Sets the value to be validated and clears the messages and errors arrays
- translateMessage() — Translate a validation message
public
- __get() — Magic function returns the value of the requested property, if and only if it is the value or a message variable.
- __invoke() — Invoke as command
- getDefaultTranslator() — Get default translation object for all validate objects
- getDefaultTranslatorTextDomain() — Get default translation text domain for all validate objects
- getMessageLength() — Returns the maximum allowed message length
- getMessageTemplates() — Returns the message templates from the validator
- getMessageVariables() — Returns an array of the names of variables that are used in constructing validation failure messages
- getMessages() — Returns array of validation failure messages
- getOption() — Returns an option
- getOptions() — Returns all available options
- getTranslator() — Return translation object
- getTranslatorTextDomain() — Return the translation text domain
- hasDefaultTranslator() — Is there a default translation object set?
- hasTranslator() — Does this validator have its own specific translator?
- isTranslatorEnabled() — Is translation enabled?
- isValueObscured() — Retrieve flag indicating whether or not value should be obfuscated in messages
- setDefaultTranslator() — Set default translation object for all validate objects
- setDefaultTranslatorTextDomain() — Set default translation text domain for all validate objects
- setMessage() — Sets the validation failure message template for a particular key
- setMessageLength() — Sets the maximum allowed message length
- setMessages() — Sets validation failure message templates given as an array, where the array keys are the message keys, and the array values are the message template strings.
- setOptions() — Sets one or multiple options
- setTranslator() — Set translation object
- setTranslatorEnabled() — Indicate whether or not translation should be enabled
- setTranslatorTextDomain() — Set translation text domain
- setValueObscured() — Set flag indicating whether or not value should be obfuscated in messages