/** * 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; }
/** * 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()); }
/** * 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()); }
/** * 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(); }