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 de données numériques
15: * @category Pry
16: * @package Validate
17: * @subpackage Validate_Validator
18: * @version 1.0.0
19: * @author Olivier ROGER <oroger.fr>
20: *
21: */
22: class Validate_Validator_Digit extends Validate_Abstract
23: {
24:
25: /**
26: * Constructeur
27: *
28: */
29: public function __construct()
30: {
31: $this->errorMsg = "doit être composé de chiffre uniquement";
32: }
33:
34: /**
35: * Validation
36: *
37: * @param string $string Element à valider
38: * @return boolean
39: */
40: public function isValid($string)
41: {
42: $string = $this->cleanString((string)$string);
43: $pattern = '`^([0-9]+)$`';
44: if(preg_match($pattern,$string))
45: return true;
46: return false;
47: }
48: }
49: ?>