FluentDOM Package
Current file: /tmp/FluentDOM/FluentDOM/Loader/StringXML.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% 7 / 7
 
FluentDOMLoaderStringXML
100.00%100.00%
100.00% 1 / 1
100.00%100.00%
100.00% 1 / 1
100.00%100.00%
100.00% 7 / 7
 public function load($source, $contentType)
100.00%100.00%
100.00% 1 / 1
100.00%100.00%
100.00% 7 / 7


       1                 : <?php                                                                        
       2                 : /**                                                                          
       3                 : * Load FluentDOM from XML string                                             
       4                 : *                                                                            
       5                 : * @version $Id: StringXML.php 431 2010-03-29 20:42:04Z subjective $          
       6                 : * @license http://www.opensource.org/licenses/mit-license.php The MIT License
       7                 : * @copyright Copyright (c) 2009 Bastian Feder, Thomas Weinert                
       8                 : *                                                                            
       9                 : * @package FluentDOM                                                         
      10                 : * @subpackage Loaders                                                        
      11                 : */                                                                           
      12                 :                                                                              
      13                 : /**                                                                          
      14                 : * include interface                                                          
      15                 : */                                                                           
      16                 : require_once(dirname(__FILE__).'/../Loader.php');                            
      17                 :                                                                              
      18                 : /**                                                                          
      19                 : * Load FluentDOM from XML string                                             
      20                 : *                                                                            
      21                 : * @package FluentDOM                                                         
      22                 : * @subpackage Loaders                                                        
      23                 : */                                                                           
      24                 : class FluentDOMLoaderStringXML implements FluentDOMLoader {                  
      25                 :                                                                              
      26                 :   /**                                                                        
      27                 :   * Load DOMDocument from xml string                                         
      28                 :   *                                                                          
      29                 :   * @param string $source xml string                                         
      30                 :   * @param string $contentType                                               
      31                 :   * @return DOMDocument|FALSE                                                
      32                 :   */                                                                         
      33                 :   public function load($source, $contentType) {                              
      34               2 :     if (is_string($source) &&                                                
      35               2 :         FALSE !== strpos($source, '<') &&                                    
      36               2 :         $contentType == 'text/xml') {                                        
      37               1 :       $dom = new DOMDocument();                                              
      38               1 :       $dom->loadXML($source);                                                
      39               1 :       return $dom;                                                           
      40                 :     }                                                                        
      41               1 :     return FALSE;                                                            
      42                 :   }                                                                          
      43                 : }                                                                            
      44                 :                                                                              

Generated by PHPUnit 3.4.12 and Xdebug 2.0.5 using PHP 5.2.13 at Sun Sep 26 1:00:19 CEST 2010.