コード例 #1
0
ファイル: AbstractEvent.php プロジェクト: phpMussel/universe
 /**
  * constructs an event object with the given parameters only if the event is known and emits the event.
  *
  * @param $eventClassName
  * @param array $parameters
  * @return mixed
  */
 public function emitIf($eventClassName, array $parameters = [])
 {
     if (strtolower(get_called_class()) === trim($eventClassName, "\\")) {
         throw new \RuntimeException('Recursions are not awesome');
     }
     return $this->emitter->emitIf($eventClassName, $parameters);
 }
コード例 #2
0
ファイル: Mussel.php プロジェクト: phpMussel/universe
 /**
  * registers a plugin. Skips already registered plugins.
  *
  * @param Plugin $plugin
  * @return $this
  */
 public function withPlugin(Plugin $plugin)
 {
     $class = get_class($plugin);
     if (!in_array($class, $this->plugins)) {
         $this->emitter->subscribe($plugin);
         $this->plugins[] = $class;
     }
     return $this;
 }