Current file: htdocs/lib/Varien/Event/Observer/Collection.php
Legend: executed not executed dead code

  Coverage
  Classes Functions / Methods Lines
Total
0.00%0.00%
0.00% 0 / 1
16.67%16.67%
16.67% 1 / 6 CRAP
16.67%16.67%
16.67% 2 / 12
 
Varien_Event_Observer_Collection
0.00%0.00%
0.00% 0 / 1
16.67%16.67%
16.67% 1 / 6
16.67%16.67%
16.67% 2 / 12
 __construct()
100.00%100.00%
100.00% 1 / 1 1
100.00%100.00%
100.00% 2 / 2
 getAllObservers()
0.00%0.00%
0.00% 0 / 1 2
0.00%0.00%
0.00% 0 / 1
 getObserverByName($observerName)
0.00%0.00%
0.00% 0 / 1 2
0.00%0.00%
0.00% 0 / 1
 addObserver(Varien_Event_Observer $observer)
0.00%0.00%
0.00% 0 / 1 2
0.00%0.00%
0.00% 0 / 2
 removeObserverByName($observerName)
0.00%0.00%
0.00% 0 / 1 2
0.00%0.00%
0.00% 0 / 2
 dispatch(Varien_Event $event)
0.00%0.00%
0.00% 0 / 1 6
0.00%0.00%
0.00% 0 / 4


       1                 : <?php                                                                                      
       2                 : /**                                                                                        
       3                 :  * Magento                                                                                 
       4                 :  *                                                                                         
       5                 :  * NOTICE OF LICENSE                                                                       
       6                 :  *                                                                                         
       7                 :  * This source file is subject to the Open Software License (OSL 3.0)                      
       8                 :  * that is bundled with this package in the file LICENSE.txt.                              
       9                 :  * It is also available through the world-wide-web at this URL:                            
      10                 :  * http://opensource.org/licenses/osl-3.0.php                                              
      11                 :  * If you did not receive a copy of the license and are unable to                          
      12                 :  * obtain it through the world-wide-web, please send an email                              
      13                 :  * to license@magentocommerce.com so we can send you a copy immediately.                   
      14                 :  *                                                                                         
      15                 :  * DISCLAIMER                                                                              
      16                 :  *                                                                                         
      17                 :  * Do not edit or add to this file if you wish to upgrade Magento to newer                 
      18                 :  * versions in the future. If you wish to customize Magento for your                       
      19                 :  * needs please refer to http://www.magentocommerce.com for more information.              
      20                 :  *                                                                                         
      21                 :  * @category   Varien                                                                      
      22                 :  * @package    Varien_Event                                                                
      23                 :  * @copyright  Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
      24                 :  * @license    http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0) 
      25                 :  */                                                                                        
      26                 :                                                                                            
      27                 :                                                                                            
      28                 : /**                                                                                        
      29                 :  * Event observer collection                                                               
      30                 :  *                                                                                         
      31                 :  * @category   Varien                                                                      
      32                 :  * @package    Varien_Event                                                                
      33                 :  * @author      Magento Core Team <core@magentocommerce.com>                               
      34                 :  */                                                                                        
      35                 : class Varien_Event_Observer_Collection                                                     
      36                 : {                                                                                          
      37                 :     /**                                                                                    
      38                 :      * Array of observers                                                                  
      39                 :      *                                                                                     
      40                 :      * @var array                                                                          
      41                 :      */                                                                                    
      42                 :     protected $_observers;                                                                 
      43                 :                                                                                            
      44                 :     /**                                                                                    
      45                 :      * Initializes observers                                                               
      46                 :      *                                                                                     
      47                 :      */                                                                                    
      48                 :     public function __construct()                                                          
      49                 :     {                                                                                      
      50              16 :         $this->_observers = array();                                                       
      51              16 :     }                                                                                      
      52                 :                                                                                            
      53                 :     /**                                                                                    
      54                 :      * Returns all observers in the collection                                             
      55                 :      *                                                                                     
      56                 :      * @return array                                                                       
      57                 :      */                                                                                    
      58                 :     public function getAllObservers()                                                      
      59                 :     {                                                                                      
      60               0 :         return $this->_observers;                                                          
      61                 :     }                                                                                      
      62                 :                                                                                            
      63                 :     /**                                                                                    
      64                 :      * Returns observer by its name                                                        
      65                 :      *                                                                                     
      66                 :      * @param string $observerName                                                         
      67                 :      * @return Varien_Event_Observer                                                       
      68                 :      */                                                                                    
      69                 :     public function getObserverByName($observerName)                                       
      70                 :     {                                                                                      
      71               0 :         return $this->_observers[$observerName];                                           
      72                 :     }                                                                                      
      73                 :                                                                                            
      74                 :     /**                                                                                    
      75                 :      * Adds an observer to the collection                                                  
      76                 :      *                                                                                     
      77                 :      * @param Varien_Event_Observer $observer                                              
      78                 :      * @return Varien_Event_Observer_Collection                                            
      79                 :      */                                                                                    
      80                 :     public function addObserver(Varien_Event_Observer $observer)                           
      81                 :     {                                                                                      
      82               0 :         $this->_observers[$observer->getName()] = $observer;                               
      83               0 :         return $this;                                                                      
      84                 :     }                                                                                      
      85                 :                                                                                            
      86                 :     /**                                                                                    
      87                 :      * Removes an observer from the collection by its name                                 
      88                 :      *                                                                                     
      89                 :      * @param string $observerName                                                         
      90                 :      * @return Varien_Event_Observer_Collection                                            
      91                 :      */                                                                                    
      92                 :     public function removeObserverByName($observerName)                                    
      93                 :     {                                                                                      
      94               0 :         unset($this->_observers[$observerName]);                                           
      95               0 :         return $this;                                                                      
      96                 :     }                                                                                      
      97                 :                                                                                            
      98                 :     /**                                                                                    
      99                 :      * Dispatches an event to all observers in the collection                              
     100                 :      *                                                                                     
     101                 :      * @param Varien_Event $event                                                          
     102                 :      * @return Varien_Event_Observer_Collection                                            
     103                 :      */                                                                                    
     104                 :     public function dispatch(Varien_Event $event)                                          
     105                 :     {                                                                                      
     106               0 :         foreach ($this->_observers as $observer) {                                         
     107               0 :             $observer->dispatch($event);                                                   
     108               0 :         }                                                                                  
     109               0 :         return $this;                                                                      
     110                 :     }                                                                                      

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.