/** * Trigger an event * * @param string $name * @param array $args * @return Application */ public function trigger($name, array $args = []) { if (count($args) == 0) { $args = ['application' => $this]; } else { if (!in_array($this, $args, true)) { $args['application'] = $this; } } $this->events->trigger($name, $args); return $this; }
/** * Detach an event. Default hook-points are: * * app.init * app.route.pre * app.route.post * app.dispatch.pre * app.dispatch.post * app.error * * @param string $name * @param mixed $action * @return Application */ public function off($name, $action) { $this->events->off($name, $action); return $this; }