Definition at line 33 of file Validate.php.
◆ addDefaultNamespaces()
static addDefaultNamespaces |
( |
|
$namespace | ) |
|
|
static |
Adds a new default namespace
- Parameters
-
- Returns
- null
Definition at line 168 of file Validate.php.
170 if (!is_array($namespace)) {
171 $namespace = array((
string) $namespace);
174 self::$_defaultNamespaces = array_unique(array_merge(self::$_defaultNamespaces, $namespace));
◆ addValidator()
Adds a validator to the end of the chain
If $breakChainOnFailure is true, then if the validator fails, the next validator in the chain, if one exists, will not be executed.
- Parameters
-
- Returns
- Zend_Validate Provides a fluent interface
Definition at line 74 of file Validate.php.
76 $this->_validators[] = array(
77 'instance' => $validator,
78 'breakChainOnFailure' => (
boolean) $breakChainOnFailure
◆ getDefaultNamespaces()
static getDefaultNamespaces |
( |
| ) |
|
|
static |
Returns the set default namespaces
- Returns
- array
Definition at line 142 of file Validate.php.
static $_defaultNamespaces
◆ getDefaultTranslator()
static getDefaultTranslator |
( |
|
$translator = null | ) |
|
|
static |
Returns the default translation object
- Returns
- Zend_Translate_Adapter|null
Definition at line 274 of file Validate.php.
276 #require_once 'Zend/Validate/Abstract.php'; static getDefaultTranslator()
◆ getErrors()
◆ getMessageLength()
static getMessageLength |
( |
| ) |
|
|
static |
Returns the maximum allowed message length
- Returns
- integer
Definition at line 252 of file Validate.php.
254 #require_once 'Zend/Validate/Abstract.php'; static getMessageLength()
◆ getMessages()
◆ hasDefaultNamespaces()
static hasDefaultNamespaces |
( |
| ) |
|
|
static |
Returns true when defaultNamespaces are set
- Returns
- boolean
Definition at line 182 of file Validate.php.
184 return (!empty(self::$_defaultNamespaces));
◆ is()
static is |
( |
|
$value, |
|
|
|
$classBaseName, |
|
|
array |
$args = array() , |
|
|
|
$namespaces = array() |
|
) |
| |
|
static |
- Parameters
-
mixed | $value | |
string | $classBaseName | |
array | $args | OPTIONAL |
mixed | $namespaces | OPTIONAL |
- Returns
- boolean
- Exceptions
-
Definition at line 195 of file Validate.php.
197 $namespaces = array_merge((array) $namespaces, self::$_defaultNamespaces, array(
'Zend_Validate'));
201 #require_once 'Zend/Loader.php'; 202 foreach($namespaces as $namespace) {
204 $file = str_replace(
'_', DIRECTORY_SEPARATOR,
$class) .
'.php';
214 if (
$class->implementsInterface(
'Zend_Validate_Interface')) {
215 if (
$class->hasMethod(
'__construct')) {
216 $keys = array_keys($args);
218 foreach($keys as $key) {
219 if (is_numeric($key)) {
226 $object =
$class->newInstanceArgs($args);
228 $object =
$class->newInstance($args);
231 $object =
$class->newInstance();
234 return $object->isValid(
$value);
239 }
catch (Exception $e) {
243 #require_once 'Zend/Validate/Exception.php'; static loadClass($class, $dirs=null)
static isReadable($filename)
$_option $_optionId $class
◆ isValid()
Returns true if and only if $value passes all validations in the chain
Validators are run in the order in which they were added to the chain (FIFO).
- Parameters
-
- Returns
- boolean
Implements Zend_Validate_Interface.
Definition at line 91 of file Validate.php.
93 $this->_messages = array();
94 $this->_errors = array();
96 foreach ($this->_validators as
$element) {
98 if ($validator->isValid(
$value)) {
102 $messages = $validator->getMessages();
103 $this->_messages = array_merge($this->_messages, $messages);
104 $this->_errors = array_merge($this->_errors, array_keys($messages));
105 if (
$element[
'breakChainOnFailure']) {
◆ setDefaultNamespaces()
static setDefaultNamespaces |
( |
|
$namespace | ) |
|
|
static |
Sets new default namespaces
- Parameters
-
- Returns
- null
Definition at line 153 of file Validate.php.
155 if (!is_array($namespace)) {
156 $namespace = array((
string) $namespace);
159 self::$_defaultNamespaces = $namespace;
◆ setDefaultTranslator()
static setDefaultTranslator |
( |
|
$translator = null | ) |
|
|
static |
Sets a default translation object for all validation objects
- Parameters
-
Definition at line 285 of file Validate.php.
287 #require_once 'Zend/Validate/Abstract.php'; static setDefaultTranslator($translator=null)
◆ setMessageLength()
static setMessageLength |
( |
|
$length = -1 | ) |
|
|
static |
Sets the maximum allowed message length
- Parameters
-
Definition at line 263 of file Validate.php.
265 #require_once 'Zend/Validate/Abstract.php'; static setMessageLength($length=-1)
◆ $_defaultNamespaces
$_defaultNamespaces = array() |
|
staticprotected |
◆ $_errors
◆ $_messages
◆ $_validators
The documentation for this class was generated from the following file: