Example #1
0
 /**
  * Dispatches an event to all registered listeners.
  *
  * @param string $eventName The name of the event to dispatch. The name of the event is
  *                          the name of the method that is invoked on listeners.
  * @param EventArgs $eventArgs The event arguments to pass to the event handlers/listeners.
  *                             If not supplied, the single empty EventArgs instance is used.
  * @return boolean
  */
 public function dispatchEvent($eventName, EventArgs $eventArgs = null)
 {
     if (isset($this->_listeners[$eventName])) {
         $eventArgs = $eventArgs === null ? EventArgs::getEmptyInstance() : $eventArgs;
         foreach ($this->_listeners[$eventName] as $listener) {
             $listener->{$eventName}($eventArgs);
         }
     }
 }
Example #2
0
 /**
  * @since 1.3
  * @param mixed $options
  */
 public function setOptions(array $options)
 {
     $this->isOptionsChanged = parent::getOptions() !== $options;
     $this->changedOptions = $this->isOptionsChanged ? $options : null;
 }
Example #3
0
 public function setData($data)
 {
     $this->isDataChanged = parent::getData() !== $data;
     $this->changedData = $this->isDataChanged ? $data : null;
 }