Esempio n. 1
0
 /**
  * Propagate an event down through the list of handlers
  * 
  * This checks if an event has been stopped or is unstoppable
  * These can be set in the handlers themselves.
  * 
  * NOTE: PriorityQueue inherits from AbsractSortedList
  *       getList() will already be sorted with the appropriate queues
  * 
  * It's important that the event passed is a reference, so that it can
  * be potentially stopped.
  * 
  * @param Falcraft\Patterns\Resource\PublisherInterface &$p
  *              The event originator
  * @param Falcraft\Event\Resource\AbstractEvent &$e
  *              The actual event object
  * 
  */
 public function propagate(PatternsResource\PublisherInterface &$p, EventResource\AbstractEvent &$e)
 {
     // foreach doesn't guarantee proper order
     $list = $this->getList();
     $count = count($list);
     for ($i = 0; $i < $count; $i++) {
         if ($e->isUnstoppable() || !$e->isStopped()) {
             $list[$i]->notify($p, $e);
         }
     }
 }