Validator for the crc32 hash of given files

category Zend
package Zend_Validate
copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
license New BSD License
inherited_from \Zend_Validate_File_Hash

 Methods

Sets validator options

__construct(string|array|\Zend_Config $options) : \Zend_Validate_File_Crc32
inherited_from \Zend_Validate_File_Hash::__construct()

Parameters

$options

stringarray\Zend_Config

Exceptions

\Zend_Validate_Exception

Returns

\Zend_Validate_File_Crc32

Sets validator options

__construct(string|array $options) 
Inherited

Parameters

$options

stringarray

Exceptions

\Zend_Validate_Exception

Magic function returns the value of the requested property, if and only if it is the value or a message variable.

__get(string $property) : mixed
Inherited

Parameters

$property

string

Exceptions

\Zend_Validate_Exception

Returns

mixed

Adds the crc32 hash for one or multiple files

addCrc32(string|array $options) : \Zend_Validate_File_Hash

Parameters

$options

stringarray

Returns

\Zend_Validate_File_HashProvides a fluent interface

Adds the crc32 hash for one or multiple files

addHash(string|array $options) : \Zend_Validate_File_Hash
inherited_from \Zend_Validate_File_Hash::addHash()

Parameters

$options

stringarray

Returns

\Zend_Validate_File_HashProvides a fluent interface

Adds the hash for one or multiple files

addHash(string|array $options) : \Zend_Validate_File_Hash
Inherited

Parameters

$options

stringarray

Exceptions

\Zend_Validate_Exception

Returns

\Zend_Validate_File_HashProvides a fluent interface

Returns all set crc32 hashes

getCrc32() : array

Returns

array

Get default translation object for all validate objects

getDefaultTranslator() : \Zend_Translate_Adapter | null
InheritedStatic

Returns

\Zend_Translate_Adapternull

Returns array of validation failure message codes

getErrors() : array
Inherited
deprecated Since 1.5.0

Returns

array

Returns the set hash values as array, the hash as key and the algorithm the value

getHash() : array
Inherited

Returns

array

Returns the maximum allowed message length

getMessageLength() : integer
InheritedStatic

Returns

integer

Returns the message templates from the validator

getMessageTemplates() : array
Inherited

Returns

array

Returns an array of the names of variables that are used in constructing validation failure messages

getMessageVariables() : array
Inherited

Returns

array

Returns array of validation failure messages

getMessages() : array
Inherited

If isValid() was never called or if the most recent isValid() call returned true, then this method returns an empty array.

inherited_from \Zend_Validate_Interface::getMessages()

Returns

array

Retrieve flag indicating whether or not value should be obfuscated in messages

getObscureValue() : boolean
Inherited

Returns

boolean

Return translation object

getTranslator() : \Zend_Translate_Adapter | null
Inherited

Returns

\Zend_Translate_Adapternull

Is there a default translation object set?

hasDefaultTranslator() : boolean
InheritedStatic

Returns

boolean

Does this validator have its own specific translator?

hasTranslator() : boolean
Inherited

Returns

boolean

Defined by Zend_Validate_Interface

isValid(string $value, array $file = null) : boolean

Returns true if and only if the given file confirms the set hash

inherited_from \Zend_Validate_File_Hash::isValid()

Parameters

$value

string

Filename to check for hash

$file

array

File data from Zend_File_Transfer

Returns

boolean

Defined by Zend_Validate_Interface

isValid(string $value, array $file = null) : boolean
Inherited

Returns true if and only if the given file confirms the set hash

Parameters

$value

string

Filename to check for hash

$file

array

File data from Zend_File_Transfer

Returns

boolean

Sets the crc32 hash for one or multiple files

setCrc32(string|array $options) : \Zend_Validate_File_Hash

Parameters

$options

stringarray

Returns

\Zend_Validate_File_HashProvides a fluent interface

Set default translation object for all validate objects

setDefaultTranslator(\Zend_Translate|\Zend_Translate_Adapter|null $translator = null
InheritedStatic

Parameters

$translator

\Zend_Translate\Zend_Translate_Adapternull

Exceptions

\Zend_Validate_Exception

Indicate whether or not translation should be disabled

setDisableTranslator(boolean $flag) : \Zend_Validate_Abstract
Inherited

Parameters

$flag

boolean

Returns

\Zend_Validate_Abstract

Sets the crc32 hash for one or multiple files

setHash(string|array $options) : \Zend_Validate_File_Hash
inherited_from \Zend_Validate_File_Hash::setHash()

Parameters

$options

stringarray

Returns

\Zend_Validate_File_HashProvides a fluent interface

Sets the hash for one or multiple files

setHash(string|array $options) : \Zend_Validate_File_Hash
Inherited

Parameters

$options

stringarray

Returns

\Zend_Validate_File_HashProvides a fluent interface

Sets the validation failure message template for a particular key

setMessage(string $messageString, string $messageKey = null) : \Zend_Validate_Abstract
Inherited

Parameters

$messageString

string

$messageKey

string

OPTIONAL

Exceptions

\Zend_Validate_Exception

Returns

\Zend_Validate_AbstractProvides a fluent interface

Sets the maximum allowed message length

setMessageLength(integer $length = -1
InheritedStatic

Parameters

$length

integer

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.

setMessages(array $messages) : \Zend_Validate_Abstract
Inherited

Parameters

$messages

array

Returns

\Zend_Validate_Abstract

Set flag indicating whether or not value should be obfuscated in messages

setObscureValue(boolean $flag) : \Zend_Validate_Abstract
Inherited

Parameters

$flag

boolean

Returns

\Zend_Validate_Abstract

Set translation object

setTranslator(\Zend_Translate|\Zend_Translate_Adapter|null $translator = null) : \Zend_Validate_Abstract
Inherited

Parameters

$translator

\Zend_Translate\Zend_Translate_Adapternull

Exceptions

\Zend_Validate_Exception

Returns

\Zend_Validate_Abstract

Is translation disabled?

translatorIsDisabled() : boolean
Inherited

Returns

boolean

Constructs and returns a validation failure message with the given message key and value.

_createMessage(string $messageKey, string $value) : string
Inherited

Returns null if and only if $messageKey does not correspond to an existing template.

If a translator is available and a translation exists for $messageKey, the translation will be used.

Parameters

$messageKey

string

$value

string

Returns

string

_error()

_error(string $messageKey, string $value = null) : void
Inherited

Parameters

$messageKey

string

$value

string

OPTIONAL

Joins elements of a multidimensional array

_implodeRecursive(array $pieces) : string
Inherited

Parameters

$pieces

array

Returns

string

Sets the value to be validated and clears the messages and errors arrays

_setValue(mixed $value) : void
Inherited

Parameters

$value

mixed

Throws an error of the given type

_throw(string $file, string $errorType) : false
Inherited

Parameters

$file

string

$errorType

string

Returns

false

 Properties

 

Default translation object for all validate objects

$_defaultTranslator : \Zend_Translate

Default

Static
 

Array of validation failure message codes

$_errors : array

Default

array()
deprecated Since 1.5.0
 

Hash of the file

$_hash : string

Default

inherited_from \Zend_Validate_File_Hash::_hash
 

Hash of the file

$_hash : string

Default

 

Limits the maximum returned length of a error message

$_messageLength : Integer

Default

-1
Static
 

Validation failure message template definitions

$_messageTemplates : array

Default

array(self::DOES_NOT_MATCH => "File '%value%' does not match the given crc32 hashes", self::NOT_DETECTED => "A crc32 hash could not be evaluated for the given file", self::NOT_FOUND => "File '%value%' is not readable or does not exist")
inherited_from \Zend_Validate_File_Hash::_messageTemplates
 

Validation failure message template definitions

$_messageTemplates : array

Default

array()
 

Additional variables available for validation failure messages

$_messageVariables : array

Default

array()
 

Array of validation failure messages

$_messages : array

Default

array()
 

Flag indidcating whether or not value should be obfuscated in error messages

$_obscureValue : boolean

Default

false
 

Translation object

$_translator : \Zend_Translate

Default

 

Is translation disabled?

$_translatorDisabled : Boolean

Default

false
 

The value to be validated

$_value : mixed

Default

 Constants

 

DOES_NOT_MATCH

DOES_NOT_MATCH = 'fileCrc32DoesNotMatch' 
const string Error constants
inherited_from \Zend_Validate_File_Hash::DOES_NOT_MATCH
 

DOES_NOT_MATCH

DOES_NOT_MATCH = 'fileHashDoesNotMatch' 
const string Error constants
 

NOT_DETECTED

NOT_DETECTED = 'fileCrc32NotDetected' 
inherited_from \Zend_Validate_File_Hash::NOT_DETECTED
 

NOT_DETECTED

NOT_DETECTED = 'fileHashHashNotDetected' 
 

NOT_FOUND

NOT_FOUND = 'fileCrc32NotFound' 
inherited_from \Zend_Validate_File_Hash::NOT_FOUND
 

NOT_FOUND

NOT_FOUND = 'fileHashNotFound'