Set the function which will trigger the end of process.

@param string $trigger Name of the trigger function. Possible values are "die" or "exception".

@throws HttpException
344502
public function setExitTrigger($trigger)
    {
        $validTriggers = [
            'die',
            'exception'
        ];
        if (!in_array($trigger, $validTriggers)) {
            throw new HttpException(('Invalid exit trigger "' . $trigger . '".'));
        }

        $this->exitTrigger = $trigger;
    }
55921
protected function searchTriggers($trigger)
    {
        synapse()->triggers->each(function ($class) use ($trigger) {
            $triggerClass = "\\Axiom\\Rivescript\\Cortex\\Triggers\\$class";
            $triggerClass = new $triggerClass();

            $found = $triggerClass->parse($trigger, $this->input);

            if ($found === true) {
                $this->getResponse($trigger);

                return false;
            }
        });
    }
965550
protected function trigger($event, ...$arguments)
    {
        if (!empty($this->handlers[$event])) {
            /** @var callable $handler */
            foreach ($this->handlers[$event] as $handler) {
                call_user_func_array($handler, $arguments);
            }
        }
    }
199156
public function setPreSendHandler($value) {
        if ($value !== null && !is_callable($value)) {
            throw new \Exception('A function is expected, or null.');
        }

        $this->preSendHandler = $value;
    }
678377
def call_release(self, arborted=False):
        """"""
        self.was_ended = arborted
        try:
            self.trigger.release()
        except (threading.ThreadError, AttributeError):
            pass
1156954
public function fire(string $event, ...$args): void
    {
        if (!isset(self::$events[$event])) {
            return;
        }

        // call event handlers of the event.
        foreach ((array)self::$eventHandlers[$event] as $cb) {
            // return FALSE to stop go on handle.
            if (false === PhpHelper::call($cb, ...$args)) {
                break;
            }
        }

        // is a once event, remove it
        if (self::$events[$event]) {
            $this->off($event);
        }
    }
1033001
public function set_trigger(callable $function, $kind = null, $moment = null, $tables = '*' ): self
  {
    $kinds = ['SELECT', 'INSERT', 'UPDATE', 'DELETE'];
    $moments = ['before', 'after'];
    if ( empty($kind) ){
      $kind = $kinds;
    }
    else if ( !\is_array($kind) ){
      $kind = (array)strtoupper($kind);
    }
    else{
      $kind = array_map('strtoupper', $kind);
    }
    if ( empty($moment) ){
      $moment = $moments;
    }
    else {
      $moment = !\is_array($moment) ? (array)strtolower($moment) : array_map('strtolower', $moment);
    }
    foreach ( $kind as $k ){
      if ( \in_array($k, $kinds, true) ){
        foreach ( $moment as $m ){
          if ( array_key_exists($m, $this->triggers[$k]) && \in_array($m, $moments, true) ){
            if ( $tables === '*' ){
              $tables = $this->get_tables();
            }
            else if ( str::check_name($tables) ){
              $tables = [$tables];
            }
            if ( \is_array($tables) ){
              foreach ( $tables as $table ){
                $t = $this->tfn($table);
                if ( !isset($this->triggers[$k][$m][$t]) ){
                  $this->triggers[$k][$m][$t] = [];
                }
                $this->triggers[$k][$m][$t][] = $function;
              }
            }
          }
        }
      }
    }
    return $this;
  }
149157
protected function silentRunActionTrigger($event)
    {
        try {
            $this->action->trigger($event, $this->control, $this->context);
        } catch (Exception $exception) {
            // Pokémon Exception Handling
        }
    }
603842
public function setEndEvent(EndEvent $endEvent): void
    {
        if ($this->endEvent) {
            throw new InvalidArgumentException('Call already completed.');
        }

        $endEvent->setCall($this);

        if (!$this->responseEvent) {
            $this->responseEvent = $endEvent;
        }

        $this->endEvent = $endEvent;
    }
1098955
public function handleException($exception)
    {
        if ($exception instanceof ExitException) {
            return;
        }

        $this->exception = $exception;

        // disable error capturing to avoid recursive errors while handling exceptions
        $this->unregister();

        // set preventive HTTP status code to 500 in case error handling somehow fails and headers are sent
        // HTTP exceptions will override this value in renderException()
        if (PHP_SAPI !== 'cli') {
            http_response_code(500);
        }

        try {
            $this->logException($exception);
            if ($this->discardExistingOutput) {
                $this->clearOutput();
            }
            $this->renderException($exception);
            if (!YII_ENV_TEST) {
                $this->profiler->flush();
                $this->flushLogger();
                exit(1);
            }
        } catch (\Throwable $e) {
            // another exception could be thrown while displaying the exception
            $this->handleFallbackExceptionMessage($e, $exception);
        }

        $this->exception = null;
    }
400604
public function setAction(string $action)
    {
        if (!empty($action) && $this->policy === Rule::NOINHERIT)
            throw new Exception("Rule::NOINHERIT can not be used in combination with an action");

        $action = (string)$action;
        if ($action !== $this->action)
        {
            $validator = $this->acl->getActionValidator();
            if (null !== $validator)
            {
                if (($reason = $validator->isValid($action)) !== true)
                    throw new Exception("Action can not be validated: " . $reason);
            }
            $this->changed = true;
            $this->action = $action;
        }
    }
1039330
public function trigger($event, $target = null, $params = null)
    {
        if (!$event instanceof Event) {
            $event = new Event($event, $target, $params);
        }

        if (false !== strpos($event->getName(), ':')) {
            $namespace = substr($event->getName(), 0, strpos($event->getName(), ':'));

            if (isset($this->listeners[$namespace])) {
                $this->fire($this->listeners[$namespace], $event);
            }
        }

        if (isset($this->listeners[$event->getName()])) {
            $this->fire($this->listeners[$event->getName()], $event);
        }

        return $event->getTarget();
    }
721027
public function fatalHandler($ex)
    {
        if (Config::getEnv("app.debug")) {
            echo "<pre>";
            echo "Exception : " , $ex->getMessage() , "<br>";
            echo "Catch position : " . $ex->getFile() . " : " . $ex->getLine() . "<br><br>";
            echo $ex->getTraceAsString();
        }else{
            echo strval(Config::getEnv("app.prod_tip"));
        }

        exit;
    }
933677
public function trigger($event)
    {

        if (is_string($event)) {
            $event = new Event($event);
        }
        $listeners = $this->getListeners($event->name);

        if (empty($listeners)) {
            return $event;
        }

        //print_r($listeners);

        //die;

        //Priorities... the bigger the more urgent
        $urgency = ksort($listeners, SORT_NUMERIC);
        $callbacks = array_reverse($listeners, true);

        //Loop through callbacks;
        foreach ($callbacks as $priority => $listener) {
            if ($event->isStopped()) {
                break;
            }

            foreach ($listener as $callback) {
                if ($event->isStopped()) {
                    break;
                }
                $this->propergate($event, $callback);
            }
        }

        return $event;
    }
1297369
public void setTrigger(final DialogOpenTrigger trigger) {
		// pre-1.2.3 compatibilty only:
		if (this.hasLegacyTriggerButton()) {
			DialogOpenTrigger theTrigger = getTrigger();
			if (theTrigger instanceof WButton) {
				remove(theTrigger);
			}
			setLegacyTriggerButton(false);
		}
		// end of backwards compatibility code.
		getOrCreateComponentModel().trigger = trigger;
	}
68844
protected function setDataEditTrigger()
    {
        $conditions = $this->getData('trigger.data.conditions');

        if (empty($conditions) || !is_array($conditions)) {
            return null;
        }

        if (!$this->isError()) {
            gplcart_array_sort($conditions);
        }

        $modified = array();

        foreach ($conditions as $condition) {
            $modified[] = is_string($condition) ? $condition : $condition['original'];
        }

        $this->setData('trigger.data.conditions', implode("\n", $modified));
    }
552204
public function setToken(string $token)
    {
        if (empty($selector)) {
            Throw new TokenException('Empty tokens are not allowed.');
        }

        $this->token = $token;
    }