My favorites | Sign in
Project Home Downloads Wiki Issues Source
Checkout   Browse   Changes    
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php

class Skjb_Validate_Switch extends Zend_Validate_Abstract
{
private $_validators = null;
private $_notFoundPass = true;

public function __construct(array $validators, $notFoundPass = true)
{
$this->_validators = $validators;
$this->_notFoundPass = $notFoundPass;
}

public function isValid($value)
{
if (isset($this->_validators[$value])) {
$validator = $this->_validators[$value];
} elseif (isset($this->_validators['default'])) {
$validator = $this->_validators['default'];
} else {
return $notFoundPass;
}

$valid = $validator->isValid($value);

if (!$valid) {
$this->_messages = $validator->getMessages();
$this->_errors = $validator->getErrors();
}

return $valid;
}
}

Change log

r59 by superhappycamperboy on May 26, 2010   Diff
Moving everything to the library subfolder
Go to: 
Project members, sign in to write a code review

Older revisions

r57 by superhappycamperboy on May 25, 2010   Diff
Fixing messages and errors
r56 by superhappycamperboy on May 25, 2010   Diff
Fixing typo
r55 by superhappycamperboy on May 25, 2010   Diff
Moving Google Maps code and adding
Switch validator
All revisions of this file

File info

Size: 886 bytes, 33 lines
Powered by Google Project Hosting