Logger.php
Current file: /home/nuno/workspace/phmagick/phMagick/Core/Logger.php
Legend: executed not executed dead code

  Coverage
  Classes Functions / Methods Lines
Total
0.00% 0 / 1
83.33% 5 / 6 CRAP
92.00% 23 / 25
Logger
0.00% 0 / 1
83.33% 5 / 6 11.06
92.00% 23 / 25
 clear()
100.00% 1 / 1 1
100.00% 2 / 2
 append($data)
100.00% 1 / 1 1
100.00% 2 / 2
 getAt($id)
100.00% 1 / 1 2
100.00% 3 / 3
 get()
100.00% 1 / 1 1
100.00% 1 / 1
 _toString($data)
0.00% 0 / 1 4.10
81.82% 9 / 11
 __toString()
100.00% 1 / 1 2
100.00% 6 / 6


       1                 : <?php                                                                                     
       2                 : namespace phMagick\Core;                                                                  
       3                 : class Logger                                                                              
       4                 : {                                                                                         
       5                 :                                                                                           
       6                 :     protected $_log = array();                                                            
       7                 :                                                                                           
       8                 :     function clear()                                                                      
       9                 :     {                                                                                     
      10               1 :         $this->_log = array();                                                            
      11               1 :     }                                                                                     
      12                 :                                                                                           
      13                 :     function append($data)                                                                
      14                 :     {                                                                                     
      15               4 :         $this->_log[] = $data;                                                            
      16               4 :     }                                                                                     
      17                 :                                                                                           
      18                 :     function getAt($id)                                                                   
      19                 :     {                                                                                     
      20               1 :         if (key_exists($id, $this->_log)) {                                               
      21               1 :             return $this->_log[$id];                                                      
      22                 :         }                                                                                 
      23                 :                                                                                           
      24               1 :         return NULL;                                                                      
      25                 :     }                                                                                     
      26                 :                                                                                           
      27                 :     function get()                                                                        
      28                 :     {                                                                                     
      29               3 :         return $this->_log;                                                               
      30                 :     }                                                                                     
      31                 :                                                                                           
      32                 :     /**                                                                                   
      33                 :      *                                                                                    
      34                 :      * @todo: revise this crap, arrays are not working properly (or the tests are screwed)
      35                 :      *                                                                                    
      36                 :      */                                                                                   
      37                 :                                                                                           
      38                 :     protected function _toString($data)                                                   
      39                 :     {                                                                                     
      40               1 :         $ret = '';                                                                        
      41                 :                                                                                           
      42               1 :         if (!is_array($data)) {                                                           
      43               1 :             $data = array($data);                                                         
      44               1 :         }                                                                                 
      45                 :                                                                                           
      46               1 :         foreach ($data as $k => $v) {                                                     
      47                 :                                                                                           
      48               1 :             if (is_array($v)) {                                                           
      49               0 :                 $ret .= $k . ":\n" . $this->_toString($v);                                
      50               0 :             } else {                                                                      
      51               1 :                 $ret .= "$v\n";                                                           
      52                 :             }                                                                             
      53                 :                                                                                           
      54               1 :         }                                                                                 
      55                 :                                                                                           
      56               1 :         return $ret;                                                                      
      57                 :     }                                                                                     
      58                 :                                                                                           
      59                 :     function __toString()                                                                 
      60                 :     {                                                                                     
      61               1 :         $data = $this->get();                                                             
      62                 :                                                                                           
      63               1 :         $ret = '';                                                                        
      64               1 :         foreach ($data as $d) {                                                           
      65               1 :             $ret .= $this->_toString($d);                                                 
      66               1 :         }                                                                                 
      67               1 :         return $ret;                                                                      
      68                 :     }                                                                                     
      69                 : }                                                                                         

Generated by PHP_CodeCoverage 1.1.1 using PHP 5.3.10 and PHPUnit 3.6.7 at Fri Apr 20 19:24:32 CEST 2012.