Current file: htdocs/.modman/magentron_emailimages/Magentron/EmailImages/Model/Mail.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% 3 / 3 CRAP
100.00%100.00%
100.00% 10 / 10
 
Magentron_EmailImages_Model_Mail
100.00%100.00%
100.00% 1 / 1
100.00%100.00%
100.00% 3 / 3
100.00%100.00%
100.00% 10 / 10
 setContext( $context )
100.00%100.00%
100.00% 1 / 1 1
100.00%100.00%
100.00% 2 / 2
 getContext()
100.00%100.00%
100.00% 1 / 1 1
100.00%100.00%
100.00% 1 / 1
 send( $transport = null )
100.00%100.00%
100.00% 1 / 1 2
100.00%100.00%
100.00% 6 / 6


       1                 : <?php                                                                                        
       2                 : /**                                                                                          
       3                 :  *    Magentron EmailImages Extension                                                        
       4                 :  *                                                                                           
       5                 :  *    @category    Magentron                                                                 
       6                 :  *    @package    Magentron_EmailImages                                                      
       7                 :  *    @author        Jeroen Derks                                                            
       8                 :  *    @copyright    Copyright (c) 2011 Jeroen Derks http://www.magentron.com                 
       9                 :  *    @license    http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
      10                 :  */                                                                                          
      11                 : class Magentron_EmailImages_Model_Mail extends Zend_Mail                                     
      12               1 : {                                                                                            
      13                 :     /**                                                                                      
      14                 :      *    Ensure images are attached only once.                                              
      15                 :      *    @var    boolean                                                                    
      16                 :      */                                                                                      
      17                 :     protected $_hasAddedImages = false;                                                      
      18                 :                                                                                              
      19                 :     /**                                                                                      
      20                 :      *    String representation for the context of the send() call.                          
      21                 :      *    When using the same context, determining image URLs from email body                
      22                 :      *    and retrieving these will be cached.                                               
      23                 :      *    @var    string                                                                     
      24                 :      */                                                                                      
      25                 :     protected $_context = null;                                                              
      26                 :                                                                                              
      27                 :                                                                                              
      28                 :     /**                                                                                      
      29                 :      *    Set context                                                                        
      30                 :      *                                                                                       
      31                 :      *    @param    string    $context    Context to use.                                    
      32                 :      *    @return    Zend_Mail            Provides fluent interface.                         
      33                 :      *                                                                                       
      34                 :      *    @see    $_context                                                                  
      35                 :      */                                                                                      
      36                 :     public function setContext( $context )                                                   
      37                 :     {                                                                                        
      38               2 :         $this->_context = $context;                                                          
      39               2 :         return $this;                                                                        
      40                 :     }                                                                                        
      41                 :                                                                                              
      42                 :                                                                                              
      43                 :     /**                                                                                      
      44                 :      *    Get context                                                                        
      45                 :      *                                                                                       
      46                 :      *    @return    string                Context in use.                                   
      47                 :      *                                                                                       
      48                 :      *    @see    $_context                                                                  
      49                 :      */                                                                                      
      50                 :     public function getContext()                                                             
      51                 :     {                                                                                        
      52               1 :         return $this->_context;                                                              
      53                 :     }                                                                                        
      54                 :                                                                                              
      55                 :                                                                                              
      56                 :     /**                                                                                      
      57                 :      *    Overriden to attach images from HTML body, if any.                                 
      58                 :      *                                                                                       
      59                 :      *    @param    Zend_Mail_Transport_Abstract    $transport                               
      60                 :      *    @return    Zend_Mail                                    Provides fluent interface  
      61                 :      *                                                                                       
      62                 :      *    @see    $_hasAddedImages,                                                          
      63                 :      *            Magentron_EmailImages_Helper_Data,                                         
      64                 :      *            Zend_Mail::send()                                                          
      65                 :      */                                                                                      
      66                 :     public function send( $transport = null )                                                
      67                 :     {                                                                                        
      68               2 :         if ( !$this->_hasAddedImages )                                                       
      69               2 :         {                                                                                    
      70               2 :             Mage::helper('emailimages')->addImages($this, $this->_context);                  
      71               2 :             $this->_hasAddedImages = true;                                                   
      72               2 :         }                                                                                    
      73                 :                                                                                              
      74               2 :         return parent::send($transport);                                                     
      75                 :     }                                                                                        

Generated by PHP_CodeCoverage 1.0.4 using PHP 5.3.4 and PHPUnit 3.5.13 at Tue Jul 5 9:07:16 UTC 2011.