./
Current file: /var/www/coruja_svn/corujito/coruja/library/CorujaArrayManipulation.class.php
Legend: executed not executed dead code

  Coverage
  Classes Functions / Methods Lines
Total
100.00%100.00%
100.00% 1 / 1
100.00%100.00%
100.00% 1 / 1
100.00%100.00%
100.00% 5 / 5
 
CorujaArrayManipulation
100.00%100.00%
100.00% 1 / 1
100.00%100.00%
100.00% 1 / 1
100.00%100.00%
100.00% 5 / 5
 public static function getArrayField($arrElement, $strKey = '', $mixNotFound = NULL)
100.00%100.00%
100.00% 1 / 1
100.00%100.00%
100.00% 5 / 5


       1                 : <?php                                                                                      
       2                 :                                                                                            
       3                 : /**                                                                                        
       4                 :  * Class with methods for array manipulation                                               
       5                 :  */                                                                                        
       6                 : class CorujaArrayManipulation                                                              
       7                 : {                                                                                          
       8                 :                                                                                            
       9                 :     /**                                                                                    
      10                 :          * Returns the value of $strKey key of $arrElement array or                        
      11                 :          * $mixNotFound in case the key doesn't exist                                      
      12                 :      *                                                                                     
      13                 :      * @param Array $arrElement Array under manipulation                                   
      14                 :          * @param string $strKey Key of desired value                                      
      15                 :          * @param unknown $mixNotFound Value returned in case the key was not found        
      16                 :      * @return unknown Field value                                                         
      17                 :      * @example $arrEx = array('a','b'); getArrayField($arrEx,1);                          
      18                 :      */                                                                                    
      19                 :     public static function getArrayField( $arrElement, $strKey = "" , $mixNotFound = NULL )
      20                 :     {                                                                                      
      21              10 :         $arrElement = (array) $arrElement;                                                 
      22              10 :         if ( isset( $arrElement[ (string) $strKey ] ) )                                    
      23              10 :         {                                                                                  
      24               3 :             return $arrElement[ (string) $strKey ];                                        
      25                 :         }                                                                                  
      26                 :         else                                                                               
      27                 :         {                                                                                  
      28               7 :             return $mixNotFounded;                                                         
      29                 :         }                                                                                  
      30                 :     }                                                                                      
      31                 :                                                                                            
      32                 : }                                                                                          
      33                 :                                                                                            
      34                 :                                                                                            
      35                 : ?>                                                                                         

Generated by PHPUnit 3.3.2 and Xdebug 2.0.2 at Tue Oct 28 15:17:39 BRT 2008.