listen() public method

Subscribe to event
public listen ( string $eventName, EventListener $eventListener = null ) : EventListener
$eventName string Event name you want to listen
$eventListener EventListener (Optional) If specified, given EventListener will be used for this event
return EventListener Return instance of EventListener
Exemplo n.º 1
0
 /**
  * binds the listeners
  */
 public function bind()
 {
     $this->eventManager->listen(Compiler\Event\ExpressionBeforeCompile::EVENT_NAME)->handler(new ExpressionListener($this->bindOnExpressions))->method('beforeCompile');
     $this->eventManager->listen(Compiler\Event\StatementBeforeCompile::EVENT_NAME)->handler(new StatementListener($this->bindOnStatements))->method('beforeCompile');
     $this->eventManager->listen(Compiler\Event\ScalarBeforeCompile::EVENT_NAME)->handler(new ScalarListener($this->bindOnScalars))->method('beforeCompile');
 }