Add a stage.
@param string   $name     Name of the stage.
@param string   $message  Message to send and ask a reply to.
@param callable $callback Callback that is called with the replying message as a parameter.
768094
protected function addStage(string $name, string $message, callable $callback): void
	{
		$this->stages[$name] = ["message" => $message, "callback" => $callback];
	}
293183
public function help($event_name, $callback)
    {
        if (!isset($this->event_helpers[$event_name]))
        {
            $this->event_helpers[$event_name] = $callback;
        }
    }
1328175
public function addMessage(Message $message)
    {
        $message->setMessageBroker($this);
        $this->messages->attach($message);
    }
1166220
public function when(string $name, callable $callback) : Event
    {
        if ($this->matchEventName($name, $this)){
            ($callback)($this);
            $this->consumed = true;
        }
        return $this;
    }
475367
public static function script($name, $callback) 
    {
        if (phpQueryPlugin_Scripts::$scriptMethods[$name]) {
            throw new Exception("Script name conflict - '$name'");
        }
        phpQueryPlugin_Scripts::$scriptMethods[$name] = $callback;
    }
1120360
public static function flash( $name = '', $message = '', $class = 'success fadeout-message' )
    {
        //We can only do something if the name isn't empty
        if( !empty( $name ) )
        {
            //No message, create it
            if( !empty( $message ) && empty( $_SESSION[$name] ) )
            {
                if( !empty( $_SESSION[$name] ) )
                {
                    unset( $_SESSION[$name] );
                }
                if( !empty( $_SESSION[$name.'_class'] ) )
                {
                    unset( $_SESSION[$name.'_class'] );
                }

                $_SESSION[$name]          = $message;
                $_SESSION[$name.'_class'] = $class;
            }
            //Message exists, display it
            elseif( !empty( $_SESSION[$name] ) && empty( $message ) )
            {
                $class   = !empty( $_SESSION[$name.'_class'] ) ? $_SESSION[$name.'_class'] : 'success';
                $message = $_SESSION[$name];
                echo '<div class="ui '.$class.' message">'.$message.'</div>';
                unset($_SESSION[$name]);
                unset($_SESSION[$name.'_class']);
            }
        }
    }
452801
public function addRuleCallback($name, Callable $callback)
    {
        if (!is_string($name)) {
            throw new \InvalidArgumentException('Rule must be a string');
        }

        $rule = $this->createRuleCallback($name, $callback);
        $this->addRule($rule);
    }
534961
public function setRuleMessage(string $name, string $message)
    {
        $this->messages['rules'][$name] = $message;
        return $this;
    }
1295669
private function publishMessage(string $name, AMQPMessage $message) : bool
    {
        $this->channel->basic_publish(
            $message,
            '',
            $name,
            $this->options['wait'] ?? false
        );

        if ($this->options['wait'] ?? false) {
            $this->channel->wait_for_pending_acks_returns();
        }

        return true;
    }
138762
public function addTo(string $address, ?string $name = null): Message
    {
        $this->to[] = [
            'address' => $address,
            'name'    => $name
        ];

        return $this;
    }
1000405
public void addEvent(UserFeedbackEvent.Level level, UserFeedbackEvent.Stage stage, String message) {
    addEvent(new UserFeedbackEvent(autoML, level, stage, message));
  }
1196014
public function add_reply_to($email, $name = null) {
		foreach ($this->reply_to as $reply_to) {
			if ($reply_to['email'] == $email) {
				return;
			}
		}

		$this->reply_to[] = [
			'name' => $name,
			'email' => strtolower($email),
		];
	}
1184511
public function addModifier($name, $callback)
    {
        if (!is_callable($callback)) {
            throw new InvalidArgumentException('Invalid argument type. Callbacks must be callable.');
        }
        $this->modifiers[$name] = $callback;
        return $this;
    }
811342
public function addCallback($name, $callback, $prio = 10)
    {
        if (!is_callable($callback)) {
            throw new \Exception("Callback not callable.", 3);
            return false;
        }
        $key = $this->getCallbackKey($callback);
        if (!isset(self::$_baseRealCallbacks[$key])) {
            self::$_baseRealCallbacks[$key] = $callback;
        }

        $this->_callbacks[$name][$prio][] = $key;
        ksort($this->_callbacks[$name]);

        return $this;
    }
996603
public function param( $param_name, $callback )
	{
		if( is_callable($callback) )
		{
			$this->_params[$param_name] = $callback( new request() );
		}
		else
		{
			$this->_params[$param_name] = $callback;
		}
	}
364808
private function callback(string $name)
    {
        if (!$this->hasCallback($name)) {
            throw new XslCallbackException('A callback with the name ' . $name . ' does not exist.');
        }

        return $this->callbacks[$name];
    }
79246
public function addMessageToQueue(Message $message, $name)
    {
        $q      = $this->getQueue($name);
        $qid    = $this->getQueueId($q->getName());
        $body   = base64_encode(serialize($message));
        $md5    = md5($body);

        $sql = 'INSERT INTO ' . $this->messageTable . '
            (queue_id, body, created, timeout, md5)
            VALUES
            (:queue_id, :body, :created, :timeout, :md5)
            ';
        $stmt = $this->getDb()->prepare($sql);
        $stmt->bindParam(':queue_id', $qid, \PDO::PARAM_INT);
        $stmt->bindParam(':body', $body, \PDO::PARAM_STR);
        $stmt->bindParam(':md5', $md5, \PDO::PARAM_STR);
        $stmt->bindValue(':created', time(), \PDO::PARAM_INT);
        $stmt->bindValue(':timeout', 30, \PDO::PARAM_INT);
        $stmt->execute();
        return true;
    }