Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordiosmosis <benaka@piwik.pro>2015-05-21 00:31:48 +0300
committerdiosmosis <benaka@piwik.pro>2015-05-21 18:32:41 +0300
commit10962b88b7138fb4ec03f6f8c00cd6edc988e4c6 (patch)
tree3a101e1bb8429a0a9838765874b45febfd75ac98 /core/EventDispatcher.php
parent2b02da9f4d69f7e30202906aaaf24a3133eb49e5 (diff)
Move EventDispatcher service to DI and remove EventDispatcher::clearAllObservers method. This method is only used to 'reset' the EventDispatcher, and is no longer necessary thanks to DI.
Diffstat (limited to 'core/EventDispatcher.php')
-rw-r--r--core/EventDispatcher.php37
1 files changed, 10 insertions, 27 deletions
diff --git a/core/EventDispatcher.php b/core/EventDispatcher.php
index 47ae487cde..2955e5b03f 100644
--- a/core/EventDispatcher.php
+++ b/core/EventDispatcher.php
@@ -9,16 +9,23 @@
namespace Piwik;
+use Piwik\Container\StaticContainer;
use Piwik\Plugin;
/**
* This class allows code to post events from anywhere in Piwik and for
* plugins to associate callbacks to be executed when events are posted.
- *
- * @method static \Piwik\EventDispatcher getInstance()
*/
-class EventDispatcher extends Singleton
+class EventDispatcher
{
+ /**
+ * @return EventDispatcher
+ */
+ public static function getInstance()
+ {
+ return StaticContainer::get('Piwik\EventDispatcher');
+ }
+
// implementation details for postEvent
const EVENT_CALLBACK_GROUP_FIRST = 0;
const EVENT_CALLBACK_GROUP_SECOND = 1;
@@ -158,30 +165,6 @@ class EventDispatcher extends Singleton
}
/**
- * Removes all registered extra observers for an event name. Only used for testing.
- *
- * @param string $eventName
- */
- public function clearObservers($eventName)
- {
- $this->extraObservers[$eventName] = array();
- }
-
- /**
- * Removes all registered extra observers. Only used for testing.
- */
- public function clearAllObservers()
- {
- foreach ($this->extraObservers as $eventName => $eventObservers) {
- if (strpos($eventName, 'Log.format') === 0) {
- continue;
- }
-
- $this->extraObservers[$eventName] = array();
- }
- }
-
- /**
* Re-posts all pending events to the given plugin.
*
* @param Plugin $plugin