StaticEventManager.php 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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-2015 Zend Technologies USA Inc. (http://www.zend.com)
  18. * @license http://framework.zend.com/license/new-bsd New BSD License
  19. */
  20. require_once 'Zend/EventManager/EventManager.php';
  21. require_once 'Zend/EventManager/SharedEventManager.php';
  22. require_once 'Zend/Stdlib/CallbackHandler.php';
  23. /**
  24. * Static version of EventManager
  25. *
  26. * @category Zend
  27. * @package Zend_EventManager
  28. * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
  29. * @license http://framework.zend.com/license/new-bsd New BSD License
  30. */
  31. class Zend_EventManager_StaticEventManager extends Zend_EventManager_SharedEventManager
  32. {
  33. /**
  34. * @var Zend_EventManager_StaticEventManager
  35. */
  36. protected static $instance;
  37. /**
  38. * Singleton
  39. *
  40. * @return void
  41. */
  42. protected function __construct()
  43. {
  44. }
  45. /**
  46. * Singleton
  47. *
  48. * @return void
  49. */
  50. private function __clone()
  51. {
  52. }
  53. /**
  54. * Retrieve instance
  55. *
  56. * @return Zend_EventManager_StaticEventManager
  57. */
  58. public static function getInstance()
  59. {
  60. if (null === self::$instance) {
  61. self::$instance = new self();
  62. }
  63. return self::$instance;
  64. }
  65. /**
  66. * Reset the singleton instance
  67. *
  68. * @return void
  69. */
  70. public static function resetInstance()
  71. {
  72. self::$instance = null;
  73. }
  74. }