/** * Flush the listeners belonging to $groupName in the current php id * * @param string $groupName * @return void */ protected function _flushByGroup($groupName) { $phpId = $this->_registry->get(SW_ENGINE_CURRENT_PHPID); if (null === $phpId) { return; } if (!isset($this->_list[$phpId])) { return; } foreach ($this->_list[$phpId] as $eventType => $listeners) { foreach ($listeners as $offset => $listener) { if ($listener->getGroup() === $groupName) { if (isset($currentEventType) && $currentEventType !== $eventType) { if (count($this->_list[$phpId][$currentEventType]) === 0) { unset($this->_list[$phpId][$currentEventType]); } } unset($this->_list[$phpId][$eventType][$offset]); $this->_count--; $currentEventType = $eventType; } } } if (isset($currentEventType)) { $this->_performListMaintenance($phpId, $currentEventType); } $logMessage = 'Flushed ALL event listeners belonging to group "%s" in the current phpId ("%d") in class "%s"'; Streamwide_Engine_Logger::debug(sprintf($logMessage, $groupName, $phpId, $this->_class)); $logMessage = 'The event listeners count for class "%s" is %d'; Streamwide_Engine_Logger::debug(sprintf($logMessage, $this->_class, $this->_count)); }
/** * Retrieve the controller reference from the registry * * @return Streamwide_Engine_Controller * @throws Exception */ public function getController() { $controller = $this->_registry->get(SW_ENGINE_CONTROLLER); if (null === $controller) { throw new Exception('Controller object not set in the registry'); } return $controller; }