Ejemplo n.º 1
0
 /**
  * It builds trigger by given name and data.
  *
  * @param string $name Name of trigger
  * @param mixed  $data Data for closure
  *
  * @return Trigger
  */
 public static function buildTrigger($name, $data)
 {
     $trigger = new Trigger($name);
     $trigger->setData($data);
     return $trigger;
 }
Ejemplo n.º 2
0
 /**
  * Executes assigned closure with given data in trigger.
  *
  * @param Trigger $trigger Instance of trigger
  *
  * @return mixed
  */
 public function run(Trigger $trigger)
 {
     return call_user_func_array($this->_closure, (array) $trigger->getData());
 }
Ejemplo n.º 3
0
Archivo: RegExp.php Proyecto: tolan/MTP
 /**
  * It returns that trigger name match to listener.
  *
  * @param Event\Trigger $trigger Instance of trigger
  *
  * @return boolean
  */
 public function match(Event\Trigger $trigger)
 {
     return (bool) preg_match($this->getMatchString(), $trigger->getName());
 }
Ejemplo n.º 4
0
Archivo: Equal.php Proyecto: tolan/MTP
 /**
  * It returns that trigger name match to listener.
  *
  * @param Event\Trigger $trigger Instance of trigger
  *
  * @return boolean
  */
 public function match(Event\Trigger $trigger)
 {
     return $this->getMatchString() === $trigger->getName();
 }