1: <?php
2: /**
3: * Pry Framework
4: *
5: * LICENSE
6: *
7: * This source file is subject to the new BSD license that is bundled
8: * with this package in the file LICENSE.txt.
9: *
10: * @version $Revision: 276 $
11: */
12:
13: /**
14: * Validateur d'égalité
15: * @category Pry
16: * @package Validate
17: * @subpackage Validate_Validator
18: * @version 1.0.0
19: * @author Olivier ROGER <oroger.fr>
20: *
21: * <code>
22: * $validator = new Validate_Validator_Equal(45);
23: * $validator -> isValid(12); // retourne false
24: * $validator -> isValid(45); // retourne true
25: * </code>
26: */
27: class Validate_Validator_Equal extends Validate_Abstract
28: {
29:
30: private $reference;
31: /**
32: * Constructeur
33: *
34: */
35: public function __construct($ref)
36: {
37: $this->reference = $ref;
38: $this->errorMsg = "n'est pas égale à $this->reference";
39: }
40:
41: /**
42: * Vérifie l'égalité des deux valeurs
43: *
44: * @param mixed $string Element à valider
45: * @return boolean
46: */
47: public function isValid($string)
48: {
49: if($this->reference == $string)
50: return true;
51: return false;
52: }
53: }
54: ?>