10 defined(
'JPATH_PLATFORM') or die;
28 protected $observers = array();
36 protected $doCallObservers =
true;
62 $this->observers[get_class($observer)] = $observer;
74 public function getObserverOfClass($observerClass)
76 if (isset($this->observers[$observerClass]))
78 return $this->observers[$observerClass];
94 public function update($event, $params)
96 if ($this->doCallObservers)
98 foreach ($this->observers as $observer)
100 $eventListener = array($observer, $event);
102 if (is_callable($eventListener))
104 call_user_func_array($eventListener, $params);
119 public function doCallObservers($enabled)
121 $oldState = $this->doCallObservers;
122 $this->doCallObservers = $enabled;