function implementing($interface) { $method = Swift_Events_ListenerMapper::getNotifyMethod($interface); if ($method) { return method_exists($this, $method); } }
/** * Get the name of the method which needs running based upon the listener name * @return string */ function getNotifyMethod($listener) { $map = Swift_Events_ListenerMapper::getMap(); if (isset($map[$listener])) { return $map[$listener]; } else { return false; } }
/** * Send a new type of event to all objects which are listening for it * @param Swift_Events The event to send * @param string The type of event */ public function notifyListeners($e, $type) { Swift_ClassLoader::load("Swift_Events_ListenerMapper"); if (!empty($this->listeners[$type]) && ($notifyMethod = Swift_Events_ListenerMapper::getNotifyMethod($type))) { $e->setSwift($this); foreach ($this->listeners[$type] as $k => $listener) { $listener->{$notifyMethod}($e); } } else { $e = null; } }