Exemple #1
0
 /**
  * Adds an event to the set of monitored events.
  *
  * @see event_add
  * @link http://www.php.net/manual/en/function.event-add.php
  *
  * @param null $events For compatibility only, used in buffered event
  *
  * @throws EventException if can't add event
  *
  * @return bool
  */
 public function enable($events = null)
 {
     if ($this->enabled || !$this->prepared) {
         return false;
     }
     if (!$this->check()) {
         throw $this->exception('Event already freed and could not be used.');
     }
     if (false === event_add($this->resource, $this->timeout)) {
         throw $this->exception('Could not add event (event_add).');
     }
     $this->base->enableEvent($this->name);
     $this->enabled = true;
     return true;
 }