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

  Coverage
  Classes Functions / Methods Lines
Total
0.00%0.00%
0.00% 0 / 1
25.00%25.00%
25.00% 2 / 8 CRAP
35.71%35.71%
35.71% 5 / 14
 
Varien_Event
0.00%0.00%
0.00% 0 / 1
25.00%25.00%
25.00% 2 / 8
35.71%35.71%
35.71% 5 / 14
 __construct(array $data=array()
100.00%100.00%
100.00% 1 / 1 1
100.00%100.00%
100.00% 3 / 3
 getObservers()
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()
0.00%0.00%
0.00% 0 / 1 2
0.00%0.00%
0.00% 0 / 2
 getName()
0.00%0.00%
0.00% 0 / 1 6
0.00%0.00%
0.00% 0 / 1
 setName($data)
100.00%100.00%
100.00% 1 / 1 1
100.00%100.00%
100.00% 2 / 2
 getBlock()
0.00%0.00%
0.00% 0 / 1 2
0.00%0.00%
0.00% 0 / 1


       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 object and dispatcher                                                             
      30                 :  *                                                                                         
      31                 :  * @category   Varien                                                                      
      32                 :  * @package    Varien_Event                                                                
      33                 :  * @author      Magento Core Team <core@magentocommerce.com>                               
      34                 :  */                                                                                        
      35                 : class Varien_Event extends Varien_Object                                                   
      36                 : {                                                                                          
      37                 :     /**                                                                                    
      38                 :      * Observers collection                                                                
      39                 :      *                                                                                     
      40                 :      * @var Varien_Event_Observer_Collection                                               
      41                 :      */                                                                                    
      42                 :     protected $_observers;                                                                 
      43                 :                                                                                            
      44                 :     /**                                                                                    
      45                 :      * Constructor                                                                         
      46                 :      *                                                                                     
      47                 :      * Initializes observers collection                                                    
      48                 :      *                                                                                     
      49                 :      * @param array $data                                                                  
      50                 :      */                                                                                    
      51                 :     public function __construct(array $data=array())                                       
      52                 :     {                                                                                      
      53              16 :         $this->_observers = new Varien_Event_Observer_Collection();                        
      54              16 :         parent::__construct($data);                                                        
      55              16 :     }                                                                                      
      56                 :                                                                                            
      57                 :     /**                                                                                    
      58                 :      * Returns all the registered observers for the event                                  
      59                 :      *                                                                                     
      60                 :      * @return Varien_Event_Observer_Collection                                            
      61                 :      */                                                                                    
      62                 :     public function getObservers()                                                         
      63                 :     {                                                                                      
      64               0 :         return $this->_observers;                                                          
      65                 :     }                                                                                      
      66                 :                                                                                            
      67                 :     /**                                                                                    
      68                 :      * Register an observer for the event                                                  
      69                 :      *                                                                                     
      70                 :      * @param Varien_Event_Observer $observer                                              
      71                 :      * @return Varien_Event                                                                
      72                 :      */                                                                                    
      73                 :     public function addObserver(Varien_Event_Observer $observer)                           
      74                 :     {                                                                                      
      75               0 :         $this->getObservers()->addObserver($observer);                                     
      76               0 :         return $this;                                                                      
      77                 :     }                                                                                      
      78                 :                                                                                            
      79                 :     /**                                                                                    
      80                 :      * Removes an observer by its name                                                     
      81                 :      *                                                                                     
      82                 :      * @param string $observerName                                                         
      83                 :      * @return Varien_Event                                                                
      84                 :      */                                                                                    
      85                 :     public function removeObserverByName($observerName)                                    
      86                 :     {                                                                                      
      87               0 :         $this->getObservers()->removeObserverByName($observerName);                        
      88               0 :         return $this;                                                                      
      89                 :     }                                                                                      
      90                 :                                                                                            
      91                 :     /**                                                                                    
      92                 :      * Dispatches the event to registered observers                                        
      93                 :      *                                                                                     
      94                 :      * @return Varien_Event                                                                
      95                 :      */                                                                                    
      96                 :     public function dispatch()                                                             
      97                 :     {                                                                                      
      98               0 :         $this->getObservers()->dispatch($this);                                            
      99               0 :         return $this;                                                                      
     100                 :     }                                                                                      
     101                 :                                                                                            
     102                 :     /**                                                                                    
     103                 :      * Retrieve event name                                                                 
     104                 :      *                                                                                     
     105                 :      * @return string                                                                      
     106                 :      */                                                                                    
     107                 :     public function getName()                                                              
     108                 :     {                                                                                      
     109               0 :         return isset($this->_data['name']) ? $this->_data['name'] : null;                  
     110                 :     }                                                                                      
     111                 :                                                                                            
     112                 :     public function setName($data)                                                         
     113                 :     {                                                                                      
     114              16 :         $this->_data['name'] = $data;                                                      
     115              16 :         return $this;                                                                      
     116                 :     }                                                                                      
     117                 :                                                                                            
     118                 :     public function getBlock()                                                             
     119                 :     {                                                                                      
     120               0 :         return $this->_getData('block');                                                   
     121                 :     }                                                                                      

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.