PHPIDS
Current file: /home/mario/workspace/php-ids.org/trunk/lib/IDS/vendors/htmlpurifier/HTMLPurifier/AttrDef/CSS/Composite.php
Legend: executed not executed dead code

  Coverage
  Classes Methods Lines
Total
100.00 %100.00%
100.00% 1 / 1
50.00 %50.00%
50.00% 1 / 2
66.67 %66.67%
66.67% 4 / 6
 
HTMLPurifier_AttrDef_CSS_Composite
100.00 %100.00%
100.00% 1 / 1
50.00 %50.00%
50.00% 1 / 2
66.67 %66.67%
66.67% 4 / 6
 public function __construct($defs)
0.00 %0.00%
0.00% 0 / 1
100.00 %100.00%
100.00% 0 / 0
 public function validate($string, $config, $context)
100.00 %100.00%
100.00% 1 / 1
60.00 %60.00%
60.00% 3 / 5


       1                 : <?php                                                                       
       2                 :                                                                             
       3                 : /**                                                                         
       4                 :  * Allows multiple validators to attempt to validate attribute.             
       5                 :  *                                                                          
       6                 :  * Composite is just what it sounds like: a composite of many validators.   
       7                 :  * This means that multiple HTMLPurifier_AttrDef objects will have a whack  
       8                 :  * at the string.  If one of them passes, that's what is returned.  This is 
       9                 :  * especially useful for CSS values, which often are a choice between       
      10                 :  * an enumerated set of predefined values or a flexible data type.          
      11                 :  */                                                                         
      12               1 : class HTMLPurifier_AttrDef_CSS_Composite extends HTMLPurifier_AttrDef       
      13                 : {                                                                           
      14                 :                                                                             
      15                 :     /**                                                                     
      16                 :      * List of HTMLPurifier_AttrDef objects that may process strings        
      17                 :      * @todo Make protected                                                 
      18                 :      */                                                                     
      19                 :     public $defs;                                                           
      20                 :                                                                             
      21                 :     /**                                                                     
      22                 :      * @param $defs List of HTMLPurifier_AttrDef objects                    
      23                 :      */                                                                     
      24                 :     public function __construct($defs) {                                    
      25                 :         $this->defs = $defs;                                                
      26                 :     }                                                                       
      27                 :                                                                             
      28                 :     public function validate($string, $config, $context) {                  
      29               2 :         foreach ($this->defs as $i => $def) {                               
      30               2 :             $result = $this->defs[$i]->validate($string, $config, $context);
      31               2 :             if ($result !== false) return $result;                          
      32               0 :         }                                                                   
      33               0 :         return false;                                                       
      34                 :     }                                                                       
      35                 :                                                                             
      36                 : }                                                                           
      37                 :                                                                             

Generated by PHPUnit 3.3.1 and Xdebug 2.0.2 at Thu Sep 25 18:42:10 CEST 2008.