Overview

Packages

  • Auth
  • Config
  • Controller
  • Date
  • Db
  • Feed
    • Abstract
    • Writers
  • File
    • Decorator
  • Form
    • Element
  • Image
  • Log
    • Writer
  • Net
    • Exception
  • None
  • PHP
  • PHPMailer
  • Session
  • Util
  • Validate
    • Validator
  • Zend
    • Registry

Classes

  • Validate_Validator_Alnum
  • Validate_Validator_Alpha
  • Validate_Validator_Cp
  • Validate_Validator_Date
  • Validate_Validator_Digit
  • Validate_Validator_Email
  • Validate_Validator_Equal
  • Validate_Validator_Interval
  • Validate_Validator_Time
  • Overview
  • Package
  • Class
  • Tree
 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 code postal Français. Prend en charge les codes postaux corse.
15:  * @category Pry
16:  * @package Validate
17:  * @subpackage Validate_Validator
18:  * @version 1.0.0 
19:  * @author Olivier ROGER <oroger.fr>
20:  */
21: class Validate_Validator_Cp extends Validate_Abstract
22: {
23:     /**
24:      * Constructeur
25:      * @access public
26:      */
27:     public function __construct()
28:     {
29:         $this->errorMsg = "n'est pas un code postal valide";
30:     }
31:     
32:     /**
33:      * Validation
34:      *
35:      * @param string $string Elément à valider
36:      * @return boolean
37:      */
38:     public function isValid($string)
39:     {
40:         $string = $this->cleanString((string)$string);
41:         $pattern = '`^(2[ab]|0[1-9]|[1-9][0-9])[0-9]{3}$`';
42:         if(preg_match($pattern,$string))
43:             return true;
44:         return false;
45:     }
46: }
47:  ?>
Pry Framework API documentation generated by ApiGen 2.6.1