Overview

Namespaces

  • None
  • PHP
  • Pry
    • Auth
      • Interfaces
    • Config
    • Controller
    • Date
    • Db
    • Feed
      • Abstracts
      • Writers
    • File
      • Decorator
    • Form
      • Element
    • Image
    • Log
      • Writer
    • Net
      • Exception
    • Session
    • Util
    • Validate
      • Validator
    • View

Classes

  • Validate
  • ValidateAbstract
  • Overview
  • Namespace
  • Class
  • Tree
 1: <?php
 2: 
 3: /**
 4:  * Pry Framework
 5:  *
 6:  * LICENSE
 7:  *
 8:  * This source file is subject to the new BSD license that is bundled
 9:  * with this package in the file LICENSE.txt.
10:  * 
11:  */
12: 
13: namespace Pry\Validate;
14: 
15: /**
16:  *
17:  * @category Pry
18:  * @package Validate
19:  * @abstract 
20:  * @version 1.0.0 
21:  * @author Olivier ROGER <oroger.fr>
22:  */
23: abstract class ValidateAbstract
24: {
25: 
26:     protected $espace;
27:     protected $errorMsg;
28: 
29:     /**
30:      * Défini le message d'erreur
31:      *
32:      * @param string $message
33:      * @access public
34:      */
35:     public function setMessage($message)
36:     {
37:         $this->errorMsg = $message;
38:     }
39: 
40:     /**
41:      * Retourne l'erreur
42:      *
43:      * @access public
44:      * @return string
45:      */
46:     public function getError()
47:     {
48:         return $this->errorMsg;
49:     }
50: 
51:     /**
52:      * Enlève les accents d'une chaine pour REGEX.
53:      *
54:      * @param string $value
55:      * @access public
56:      * @return string
57:      */
58:     public function cleanString($value)
59:     {
60:         $accent = array('À', 'Á', 'Â', 'Ã', 'Ä', 'Å', 'à', 'á', 'â', 'ã', 'ä', 'å', 'Ò', 'Ó', 'Ô', 'Õ', 'Ö', 'Ø', 'ò', 'ó', 'ô', 'õ', 'ö', 'ø', 'È', 'É', 'Ê', 'Ë', 'è', 'é', 'ê', 'ë', 'Ç', 'ç', 'Ì', 'Í', 'Î', 'Ï', 'ì', 'í', 'î', 'ï', 'Ù', 'Ú', 'Û,', 'Ü', 'ù', 'ú', 'û', 'ü', 'ÿ', 'Ñ', 'ñ');
61:         $pasaccent = array('A', 'A', 'A', 'A', 'A', 'A', 'a', 'a', 'a', 'a', 'a', 'a', 'O', 'O', 'O', 'O', 'O', 'O', 'o', 'o', 'o', 'o', 'o', 'o', 'E', 'E', 'E', 'E', 'e', 'e', 'e', 'e', 'C', 'c', 'I', 'I', 'I', 'I', 'i', 'i', 'i', 'i', 'U', 'U', 'U,', 'U', 'u', 'u', 'u', 'u', 'y', 'N', 'n');
62:         return str_replace($accent, $pasaccent, $value);
63:     }
64: 
65:     /**
66:      * Validation
67:      *
68:      * @abstract 
69:      * @param string $string
70:      * @return boolean
71:      */
72:     abstract protected function isValid($string);
73: }
74: 
75: ?>
Pry API documentation generated by ApiGen 2.8.0