web/lib/Zend/EventManager/StaticEventManager.php
changeset 808 6b6c2214f778
child 1230 68c69c656a2c
equal deleted inserted replaced
807:877f952ae2bd 808:6b6c2214f778
       
     1 <?php
       
     2 /**
       
     3  * Zend Framework
       
     4  *
       
     5  * LICENSE
       
     6  *
       
     7  * This source file is subject to the new BSD license that is bundled
       
     8  * with this package in the file LICENSE.txt.
       
     9  * It is also available through the world-wide-web at this URL:
       
    10  * http://framework.zend.com/license/new-bsd
       
    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@zend.com so we can send you a copy immediately.
       
    14  *
       
    15  * @category   Zend
       
    16  * @package    Zend_EventManager
       
    17  * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
       
    18  * @license    http://framework.zend.com/license/new-bsd     New BSD License
       
    19  */
       
    20 
       
    21 require_once 'Zend/EventManager/EventManager.php';
       
    22 require_once 'Zend/EventManager/SharedEventManager.php';
       
    23 require_once 'Zend/Stdlib/CallbackHandler.php';
       
    24 
       
    25 /**
       
    26  * Static version of EventManager
       
    27  *
       
    28  * @category   Zend
       
    29  * @package    Zend_EventManager
       
    30  * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
       
    31  * @license    http://framework.zend.com/license/new-bsd     New BSD License
       
    32  */
       
    33 class Zend_EventManager_StaticEventManager extends Zend_EventManager_SharedEventManager
       
    34 {
       
    35     /**
       
    36      * @var Zend_EventManager_StaticEventManager
       
    37      */
       
    38     protected static $instance;
       
    39 
       
    40     /**
       
    41      * Singleton
       
    42      * 
       
    43      * @return void
       
    44      */
       
    45     protected function __construct()
       
    46     {
       
    47     }
       
    48 
       
    49     /**
       
    50      * Singleton
       
    51      *
       
    52      * @return void
       
    53      */
       
    54     private function __clone()
       
    55     {
       
    56     }
       
    57 
       
    58     /**
       
    59      * Retrieve instance
       
    60      * 
       
    61      * @return Zend_EventManager_StaticEventManager
       
    62      */
       
    63     public static function getInstance()
       
    64     {
       
    65         if (null === self::$instance) {
       
    66             self::$instance = new self();
       
    67         }
       
    68         return self::$instance;
       
    69     }
       
    70 
       
    71     /**
       
    72      * Reset the singleton instance
       
    73      * 
       
    74      * @return void
       
    75      */
       
    76     public static function resetInstance()
       
    77     {
       
    78         self::$instance = null;
       
    79     }
       
    80 }