Zend\Validator\File\ExcludeMimeType
Validator for the mime type of a file
Synopsis
class ExcludeMimeType
extends MimeType
{
- // constants
- const FALSE_TYPE = 'fileExcludeMimeTypeFalse';
- const NOT_DETECTED = 'fileExcludeMimeTypeNotDetected';
- const NOT_READABLE = 'fileExcludeMimeTypeNotReadable';
- // Inherited constants from MimeType
- const FALSE_TYPE = 'fileMimeTypeFalse';
- const NOT_DETECTED = 'fileMimeTypeNotDetected';
- const NOT_READABLE = 'fileMimeTypeNotReadable';
- // Inherited members from MimeType
- protected array $messageTemplates;
- protected array $messageVariables;
- protected string $type;
- protected resource $finfo;
- protected array $magicFiles;
- protected array $options;
- // Inherited members from AbstractValidator
- protected mixed $value;
- protected TranslatorInterface $defaultTranslator;
- protected string $defaultTranslatorTextDomain;
- protected integer $messageLength;
- protected array $abstractOptions;
- // methods
- public bool isValid()
- // Inherited methods from MimeType
- public void __construct()
- public string getMagicFile()
- public MimeType setMagicFile()
- public MimeType disableMagicFile()
- public bool isMagicFileDisabled()
- public bool getHeaderCheck()
- public MimeType enableHeaderCheck()
- public string|array getMimeType()
- public MimeType setMimeType()
- public MimeType addMimeType()
- public bool isValid()
- // 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 |
---|---|
FALSE_TYPE | 'fileExcludeMimeTypeFalse' |
NOT_DETECTED | 'fileExcludeMimeTypeNotDetected' |
NOT_READABLE | 'fileExcludeMimeTypeNotReadable' |
FALSE_TYPE | 'fileMimeTypeFalse' |
NOT_DETECTED | 'fileMimeTypeNotDetected' |
NOT_READABLE | 'fileMimeTypeNotReadable' |
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 - $finfo
—
resource
Finfo object to use - $magicFiles
—
array
If no environment variable 'MAGIC' is set, try and autodiscover it based on common locations - $messageLength
—
int
Limits the maximum returned length of an error message - $messageTemplates — array
- $messageVariables — array
- $options
—
array
Options for this validator - $type — string
- $value
—
mixed
The value to be validated
Methods
public
- isValid() — Returns true if the mimetype of the file does not matche the given ones. Also parts of mimetypes can be checked. If you give for example "image" all image mime types will not be accepted like "image/gif", "image/jpeg" and so on.
Inherited from Zend\Validator\File\MimeType
public
- addMimeType() — Adds the mimetypes
- disableMagicFile() — Disables usage of MagicFile
- enableHeaderCheck() — Defines if the http header should be used Note that this is unsafe and therefor the default value is false
- getHeaderCheck() — Returns the Header Check option
- getMagicFile() — Returns the actual set magicfile
- getMimeType() — Returns the set mimetypes
- isMagicFileDisabled() — Is usage of MagicFile disabled?
- isValid() — Defined by Zend\Validator\ValidatorInterface
- setMagicFile() — Sets the magicfile to use if null, the MAGIC constant from php is used if the MAGIC file is erroneous, no file will be set if false, the default MAGIC file from PHP will be used
- setMimeType() — Sets the mimetypes
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