LoggerLocationInfo.php
Current file: /home/ihabunek/apache/log4php/src/main/php/LoggerLocationInfo.php
Legend: executed not executed dead code

  Coverage
  Classes Functions / Methods Lines
Total
0.00% 0 / 1
83.33% 5 / 6 CRAP
91.67% 11 / 12
LoggerLocationInfo
0.00% 0 / 1
83.33% 5 / 6 15.13
91.67% 11 / 12
 __construct($trace, $fqcn = null)
100.00% 1 / 1 5
100.00% 7 / 7
 getClassName()
100.00% 1 / 1 2
100.00% 1 / 1
 getFileName()
100.00% 1 / 1 2
100.00% 1 / 1
 getLineNumber()
100.00% 1 / 1 2
100.00% 1 / 1
 getMethodName()
100.00% 1 / 1 2
100.00% 1 / 1
 getFullInfo()
0.00% 0 / 1 6
0.00% 0 / 1


       1                 : <?php                                                                                    
       2                 : /**                                                                                      
       3                 :  * Licensed to the Apache Software Foundation (ASF) under one or more                    
       4                 :  * contributor license agreements. See the NOTICE file distributed with                  
       5                 :  * this work for additional information regarding copyright ownership.                   
       6                 :  * The ASF licenses this file to You under the Apache License, Version 2.0               
       7                 :  * (the "License"); you may not use this file except in compliance with                  
       8                 :  * the License. You may obtain a copy of the License at                                  
       9                 :  *                                                                                       
      10                 :  *       http://www.apache.org/licenses/LICENSE-2.0                                      
      11                 :  *                                                                                       
      12                 :  * Unless required by applicable law or agreed to in writing, software                   
      13                 :  * distributed under the License is distributed on an "AS IS" BASIS,                     
      14                 :  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.              
      15                 :  * See the License for the specific language governing permissions and                   
      16                 :  * limitations under the License.                                                        
      17                 :  *                                                                                       
      18                 :  * @package log4php                                                                      
      19                 :  */                                                                                      
      20                 :                                                                                          
      21                 : /**                                                                                      
      22                 :  * The internal representation of caller location information.                           
      23                 :  *                                                                                       
      24                 :  * @version $Revision: 822448 $                                                          
      25                 :  * @package log4php                                                                      
      26                 :  * @since 0.3                                                                            
      27                 :  */                                                                                      
      28                 : class LoggerLocationInfo {                                                               
      29                 :     /**                                                                                  
      30                 :      * When location information is not available the constant                           
      31                 :      * <i>NA</i> is returned. Current value of this string                               
      32                 :      * constant is <b>?</b>.                                                             
      33                 :      */                                                                                  
      34                 :     const LOCATION_INFO_NA = 'NA';                                                       
      35                 :                                                                                          
      36                 :     /**                                                                                  
      37                 :     * @var string Caller's line number.                                                  
      38                 :     */                                                                                   
      39                 :     protected $lineNumber = null;                                                        
      40                 :                                                                                          
      41                 :     /**                                                                                  
      42                 :     * @var string Caller's file name.                                                    
      43                 :     */                                                                                   
      44                 :     protected $fileName = null;                                                          
      45                 :                                                                                          
      46                 :     /**                                                                                  
      47                 :     * @var string Caller's fully qualified class name.                                   
      48                 :     */                                                                                   
      49                 :     protected $className = null;                                                         
      50                 :                                                                                          
      51                 :     /**                                                                                  
      52                 :     * @var string Caller's method name.                                                  
      53                 :     */                                                                                   
      54                 :     protected $methodName = null;                                                        
      55                 :                                                                                          
      56                 :     /**                                                                                  
      57                 :     * @var string                                                                        
      58                 :     */                                                                                   
      59                 :     protected $fullInfo = null;                                                          
      60                 :                                                                                          
      61                 :     /**                                                                                  
      62                 :      * Instantiate location information based on a {@link PHP_MANUAL#debug_backtrace}.   
      63                 :      *                                                                                   
      64                 :      * @param array $trace                                                               
      65                 :      * @param mixed $caller                                                              
      66                 :      */                                                                                  
      67                 :     public function __construct($trace, $fqcn = null) {                                  
      68              20 :         $this->lineNumber = isset($trace['line']) ? $trace['line'] : null;               
      69              20 :         $this->fileName = isset($trace['file']) ? $trace['file'] : null;                 
      70              20 :         $this->className = isset($trace['class']) ? $trace['class'] : null;              
      71              20 :         $this->methodName = isset($trace['function']) ? $trace['function'] : null;       
      72              20 :         $this->fullInfo = $this->getClassName() . '.' . $this->getMethodName() .         
      73              20 :             '(' . $this->getFileName() . ':' . $this->getLineNumber() . ')';             
      74              20 :     }                                                                                    
      75                 :                                                                                          
      76                 :     public function getClassName() {                                                     
      77              20 :         return ($this->className === null) ? self::LOCATION_INFO_NA : $this->className;  
      78                 :     }                                                                                    
      79                 :                                                                                          
      80                 :     /**                                                                                  
      81                 :      *    Return the file name of the caller.                                            
      82                 :      *    <p>This information is not always available.                                   
      83                 :      */                                                                                  
      84                 :     public function getFileName() {                                                      
      85              20 :         return ($this->fileName === null) ? self::LOCATION_INFO_NA : $this->fileName;    
      86                 :     }                                                                                    
      87                 :                                                                                          
      88                 :     /**                                                                                  
      89                 :      *    Returns the line number of the caller.                                         
      90                 :      *    <p>This information is not always available.                                   
      91                 :      */                                                                                  
      92                 :     public function getLineNumber() {                                                    
      93              20 :         return ($this->lineNumber === null) ? self::LOCATION_INFO_NA : $this->lineNumber;
      94                 :     }                                                                                    
      95                 :                                                                                          
      96                 :     /**                                                                                  
      97                 :      *    Returns the method name of the caller.                                         
      98                 :      */                                                                                  
      99                 :     public function getMethodName() {                                                    
     100              20 :         return ($this->methodName === null) ? self::LOCATION_INFO_NA : $this->methodName;
     101                 :     }                                                                                    
     102                 :                                                                                          
     103                 :     /**                                                                                  
     104                 :      *    Returns the full information of the caller.                                    
     105                 :      */                                                                                  
     106                 :     public function getFullInfo() {                                                      
     107               0 :         return ($this->fullInfo === null) ? self::LOCATION_INFO_NA : $this->fullInfo;    
     108                 :     }                                                                                    
     109                 :                                                                                          
     110                 : }                                                                                        

Generated by PHP_CodeCoverage 1.1.1 using PHP 5.3.3-7+squeeze3 and PHPUnit 3.6.3 at Sat Feb 18 22:32:39 GMT 2012.