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

  Coverage
  Classes Methods Lines
Total
100.00 %100.00%
100.00% 1 / 1
0.00 %0.00%
0.00% 0 / 1
7.14 %7.14%
7.14% 1 / 14
 
HTMLPurifier_AttrDef_CSS_TextDecoration
100.00 %100.00%
100.00% 1 / 1
0.00 %0.00%
0.00% 0 / 1
7.14 %7.14%
7.14% 1 / 14
 public function validate($string, $config, $context)
0.00 %0.00%
0.00% 0 / 1
0.00 %0.00%
0.00% 0 / 13


       1                 : <?php                                                                     
       2                 :                                                                           
       3                 : /**                                                                       
       4                 :  * Validates the value for the CSS property text-decoration               
       5                 :  * @note This class could be generalized into a version that acts sort of 
       6                 :  *       like Enum except you can compound the allowed values.            
       7                 :  */                                                                       
       8               1 : class HTMLPurifier_AttrDef_CSS_TextDecoration extends HTMLPurifier_AttrDef
       9                 : {                                                                         
      10                 :                                                                           
      11                 :     public function validate($string, $config, $context) {                
      12                 :                                                                           
      13                 :         static $allowed_values = array(                                   
      14                 :             'line-through' => true,                                       
      15                 :             'overline' => true,                                           
      16                 :             'underline' => true,                                          
      17               0 :         );                                                                
      18                 :                                                                           
      19               0 :         $string = strtolower($this->parseCDATA($string));                 
      20                 :                                                                           
      21               0 :         if ($string === 'none') return $string;                           
      22                 :                                                                           
      23               0 :         $parts = explode(' ', $string);                                   
      24               0 :         $final = '';                                                      
      25               0 :         foreach ($parts as $part) {                                       
      26               0 :             if (isset($allowed_values[$part])) {                          
      27               0 :                 $final .= $part . ' ';                                    
      28               0 :             }                                                             
      29               0 :         }                                                                 
      30               0 :         $final = rtrim($final);                                           
      31               0 :         if ($final === '') return false;                                  
      32               0 :         return $final;                                                    
      33                 :                                                                           
      34                 :     }                                                                     
      35                 :                                                                           
      36                 : }                                                                         
      37                 :                                                                           

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