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 d'interval numérique. Inclusif
15:  * @category Pry
16:  * @package Validate
17:  * @subpackage Validate_Validator
18:  * @version 1.1.0 
19:  * @author Olivier ROGER <oroger.fr>
20:  * @todo Gestion inclusif/strict      
21:  *
22:  */
23: class Validate_Validator_Interval extends Validate_Abstract
24: {
25:     private $max;
26:     private $min;
27:     
28:     /**
29:      * Constructeur
30:      *
31:      * @param array $options
32:      * @access public
33:      */
34:     public function __construct(array $options)
35:     {
36:         if(!isset($options[0]) || !isset($options[1]))
37:         {
38:             throw new InvalidArgumentException('Veuillez fournir les options d\'interval : array(12,24)');
39:         }
40:         $this->max = max($options);
41:         $this->min = min($options);
42:         $this->errorMsg = 'La valeur n\'est pas contenu dans l\'interval '.$this->min.' - '.$this->max;
43:     }
44:     
45:     /**
46:      * Vérifie si $value est dans l'interval
47:      *
48:      * @param int $value
49:      * @access public
50:      * @return boolean
51:      */
52:     public function isValid($value)
53:     {
54:         if(is_numeric($value))
55:             if($value>=$this->min && $value<= $this->max)
56:                 return true;
57:         return false;
58:     }
59: }
60:  ?>
Pry Framework API documentation generated by ApiGen 2.6.1