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

  Coverage
  Classes Methods Lines
Total
100.00 %100.00%
100.00% 1 / 1
100.00 %100.00%
100.00% 2 / 2
92.86 %92.86%
92.86% 13 / 14
 
HTMLPurifier_EntityLookup
100.00 %100.00%
100.00% 1 / 1
100.00 %100.00%
100.00% 2 / 2
92.86 %92.86%
92.86% 13 / 14
 public function setup($file = false)
100.00 %100.00%
100.00% 1 / 1
100.00 %100.00%
100.00% 5 / 5
 public static function instance($prototype = false)
100.00 %100.00%
100.00% 1 / 1
87.50 %87.50%
87.50% 7 / 8


       1                 : <?php                                                                               
       2                 :                                                                                     
       3                 : /**                                                                                 
       4                 :  * Object that provides entity lookup table from entity name to character           
       5                 :  */                                                                                 
       6               1 : class HTMLPurifier_EntityLookup {                                                   
       7                 :                                                                                     
       8                 :     /**                                                                             
       9                 :      * Assoc array of entity name to character represented.                         
      10                 :      */                                                                             
      11                 :     public $table;                                                                  
      12                 :                                                                                     
      13                 :     /**                                                                             
      14                 :      * Sets up the entity lookup table from the serialized file contents.           
      15                 :      * @note The serialized contents are versioned, but were generated              
      16                 :      *       using the maintenance script generate_entity_file.php                  
      17                 :      * @warning This is not in constructor to help enforce the Singleton            
      18                 :      */                                                                             
      19                 :     public function setup($file = false) {                                          
      20               1 :         if (!$file) {                                                               
      21               1 :             $file = HTMLPURIFIER_PREFIX . '/HTMLPurifier/EntityLookup/entities.ser';
      22               1 :         }                                                                           
      23               1 :         $this->table = unserialize(file_get_contents($file));                       
      24               1 :     }                                                                               
      25                 :                                                                                     
      26                 :     /**                                                                             
      27                 :      * Retrieves sole instance of the object.                                       
      28                 :      * @param Optional prototype of custom lookup table to overload with.           
      29                 :      */                                                                             
      30                 :     public static function instance($prototype = false) {                           
      31                 :         // no references, since PHP doesn't copy unless modified                    
      32               2 :         static $instance = null;                                                    
      33               2 :         if ($prototype) {                                                           
      34               0 :             $instance = $prototype;                                                 
      35               2 :         } elseif (!$instance) {                                                     
      36               1 :             $instance = new HTMLPurifier_EntityLookup();                            
      37               1 :             $instance->setup();                                                     
      38               1 :         }                                                                           
      39               2 :         return $instance;                                                           
      40                 :     }                                                                               
      41                 :                                                                                     
      42                 : }                                                                                   
      43                 :                                                                                     

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