Validate/Abstract.php

Show: PublicProtectedPrivateinherited
Table of Contents
Zend Framework

LICENSE

This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to license@zend.com so we can send you a copy immediately.

Category
Zend  
Copyright
Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Package
Zend_Validate  
Version
$Id: Abstract.php 25105 2012-11-07 20:33:22Z rob $  

\Zend_Validate_Abstract

Package: Zend\Validate
Implements
\Zend_Validate_Interface
Children
\Zend_Validate_Ip
\Zend_Validate_Hostname
Category
Zend  
Copyright
Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  

Properties

>VPropertyprotected\Zend_Translate $_defaultTranslator
static
Default translation object for all validate objects
Details
Type
\Zend_Translate
>VPropertyprotectedarray $_errors = array()
Array of validation failure message codes
Default valuearray()Details
Type
array
Deprecated
Since 1.5.0  
>VPropertyprotectedInteger $_messageLength = -1
static
Limits the maximum returned length of a error message
Default value-1Details
Type
Integer
>VPropertyprotectedarray $_messageTemplates = array()
Validation failure message template definitions
Default valuearray()Details
Type
array
>VPropertyprotectedarray $_messageVariables = array()
Additional variables available for validation failure messages
Default valuearray()Details
Type
array
>VPropertyprotectedarray $_messages = array()
Array of validation failure messages
Default valuearray()Details
Type
array
>VPropertyprotectedbool $_obscureValue = false
Flag indidcating whether or not value should be obfuscated in error messages
Default valuefalseDetails
Type
bool
>VPropertyprotected\Zend_Translate $_translator
Translation object
Details
Type
\Zend_Translate
>VPropertyprotectedBoolean $_translatorDisabled = false
Is translation disabled?
Default valuefalseDetails
Type
Boolean
>VPropertyprotectedmixed $_value
The value to be validated
Details
Type
mixed

Methods

methodpublic__get(string $property) : mixed

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

Parameters
NameTypeDescription
$propertystring
Returns
TypeDescription
mixed
Throws
ExceptionDescription
\Zend_Validate_Exception
methodprotected_createMessage(string $messageKey, string $value) : string

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

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
NameTypeDescription
$messageKeystring
$valuestring
Returns
TypeDescription
string
methodprotected_error(string $messageKey, string $value = null) : void

Parameters
NameTypeDescription
$messageKeystring
$valuestring

OPTIONAL

methodprotected_setValue(mixed $value) : void

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

Parameters
NameTypeDescription
$valuemixed
methodpublicgetDefaultTranslator() : \Zend_Translate_Adapter | null
static

Get default translation object for all validate objects

Returns
TypeDescription
\Zend_Translate_Adapter | null
methodpublicgetErrors() : array

Returns array of validation failure message codes

Returns
TypeDescription
array
Details
Deprecated
Since 1.5.0  
methodpublicgetMessageLength() : integer
static

Returns the maximum allowed message length

Returns
TypeDescription
integer
methodpublicgetMessageTemplates() : array

Returns the message templates from the validator

Returns
TypeDescription
array
methodpublicgetMessageVariables() : array

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

Returns
TypeDescription
array
methodpublicgetMessages() : array

Returns array of validation failure messages

The array keys are validation failure message identifiers, and the array values are the corresponding human-readable message strings.

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

Returns
TypeDescription
array
methodpublicgetObscureValue() : bool

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

Returns
TypeDescription
bool
methodpublicgetTranslator() : \Zend_Translate_Adapter | null

Return translation object

Returns
TypeDescription
\Zend_Translate_Adapter | null
methodpublichasDefaultTranslator() : boolean
static

Is there a default translation object set?

Returns
TypeDescription
boolean
methodpublichasTranslator() : bool

Does this validator have its own specific translator?

Returns
TypeDescription
bool
methodpublicisValid(mixed $value) : boolean
inherited

Returns true if and only if $value meets the validation requirements

Inherited from: \Zend_Validate_Interface::isValid()

If $value fails validation, then this method returns false, and getMessages() will return an array of messages that explain why the validation failed.

Parameters
NameTypeDescription
$valuemixed
Returns
TypeDescription
boolean
Throws
ExceptionDescription
\Zend_Validate_ExceptionIf validation of $value is impossible
methodpublicsetDefaultTranslator(\Zend_Translate | \Zend_Translate_Adapter | null $translator = null) : void
static

Set default translation object for all validate objects

Parameters
NameTypeDescription
$translator\Zend_Translate | \Zend_Translate_Adapter | null
methodpublicsetDisableTranslator(bool $flag) : \Zend_Validate_Abstract

Indicate whether or not translation should be disabled

Parameters
NameTypeDescription
$flagbool
Returns
TypeDescription
\Zend_Validate_Abstract
methodpublicsetMessage(string $messageString, string $messageKey = null) : \Zend_Validate_Abstract

Sets the validation failure message template for a particular key

Parameters
NameTypeDescription
$messageStringstring
$messageKeystring

OPTIONAL

Returns
TypeDescription
\Zend_Validate_AbstractProvides a fluent interface
Throws
ExceptionDescription
\Zend_Validate_Exception
methodpublicsetMessageLength(integer $length = -1) : void
static

Sets the maximum allowed message length

Parameters
NameTypeDescription
$lengthinteger
methodpublicsetMessages(array $messages) : \Zend_Validate_Abstract

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.

Parameters
NameTypeDescription
$messagesarray
Returns
TypeDescription
\Zend_Validate_Abstract
methodpublicsetObscureValue(bool $flag) : \Zend_Validate_Abstract

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

Parameters
NameTypeDescription
$flagbool
Returns
TypeDescription
\Zend_Validate_Abstract
methodpublicsetTranslator(\Zend_Translate | \Zend_Translate_Adapter | null $translator = null) : \Zend_Validate_Abstract

Set translation object

Parameters
NameTypeDescription
$translator\Zend_Translate | \Zend_Translate_Adapter | null
Returns
TypeDescription
\Zend_Validate_Abstract
methodpublictranslatorIsDisabled() : bool

Is translation disabled?

Returns
TypeDescription
bool
Documentation was generated by phpDocumentor 2.0.0a12.