Injest, and route an incomming message

@param   stdClass  $message  the incomming message
@return  void
181653
protected function injest($message)
	{
		switch($message->MessageType)
		{
			case static::MESSAGE_TYPE_BROADCAST:
				$this->handleBroadcast($message);
				break;
			case static::MESSAGE_TYPE_STANDARD:
				$this->handleStandard($message);
				break;
			case static::MESSAGE_TYPE_REQUEST:
				$this->handleRequest($message);
				break;
			case static::MESSAGE_TYPE_REPLY:
				$this->handleReply($message);
				break;
			default:
				throw new ClientException('Unknown MessageType: ' . var_export($message->MessageType, true));
		}
	}
758292
protected function appendMessage(Message $message): void
    {
        $this->messages[] = $message;

        if (sizeof($this->messages) > 100) {
            array_shift($this->messages);
        }
    }
761400
public function addMessage($message) {
        $migrationName = get_class($this);
        $this->messages[] = sprintf("%s:  %s\n", $migrationName, $message);
    }
65458
protected function debug($message)
    {
        if ($this->debug) {
            if ($this->debug_handler) {
                call_user_func_array(
                    $this->debug_handler, array(&$this, $message)
                );
            } else {
                echo "DEBUG: $message\n";
            }
        }
    }
377342
protected function processMessage($message) {
    // Check if the message was forward
    isset($message['forward_from']) ? $index = 'forward_from' : $index = 'from';

    $response = $this->prepareResponse($message[$index]);
    $this->sendMessage($response);
  }
566105
protected function logMessage($message)
    {
        $emails = implode(', ', array_keys((array) $message->getTo()));

        $this->logger->info("Pretending to mail message to: {$emails}");
    }
645223
public function violate($message)
    {
        if (!empty($this->messages)){
            $message = $this->messages[0];
        } else {
            $this->setMessage($message);
        }
    }
700784
public function handle(MessageReceived $message): void
    {
        $context = context();

        if ($context->getInteraction() instanceof $this) {
            $this->process($message);
        } else {
            $context->setInteraction($this);
            $this->run($message);
        }
    }
305894
public function handle(InitMessage $message)
    {
        $output = $message->getOutput();
        $configStorage = $message->getConfigStorage();

        if ($configStorage->isInitialized($message->getConfig())) {
            $output->writeln(sprintf(
                '%s is already initialised!',
                $message->getCliCommand()->getApplication()->getName()
            ));

            return;
        }

        $result = $configStorage->write($message->getConfig());

        if ($result !== false) {
            $msg = sprintf('Config file created at "<info>%s</info>".', $message->getConfig()->getFileName());
        } else {
            $msg = sprintf(
                '<error>Error: Could not create and write file "<info>%s</info>". '.
                'Please check file and directory permissions.</error>',
                $message->getConfig()->getFileName()
            );
        }
        $output->writeln($msg);
    }
581545
public function sendMessageToBrowser($message)
    {
        if (!$this->outputStarted) {
            ob_start();
            echo '<!DOCTYPE html><html lang="en"><head></head><body>';
            $this->outputStarted = true;
        }

        echo strip_tags($message, '<h1><p><br><hr>');
        echo '<br />';
        echo str_repeat(" ", 6024), "\n";
        ob_flush();
        flush();
    }
1234610
private function log($message)
    {
        if (!is_null($this->logger)) {
            $this->logger->log(
                LogLevel::DEBUG,
                sprintf("[%s] - %s", date('Y-m-d H:i:s'), $message)
            );
        }
    }
1154451
protected function flush($message) {
        switch ($this->output) {
            case self::PRINT_AS_OUTPUT:
                IO::out($message);
                break;
            case self::PRINT_AS_MESSAGE:
                IO::err($message);
                break;
        }
    }
936751
public function send(Message $message) : void
    {
        $sender = $this->smtp['sender'];
        $recipients = is_array($sender['to']) ? $sender['to'] : [$sender['to']];

        $message->setFrom($sender['email'], $sender['name']);

        foreach ($recipients as $to)
        {
            $message->addTo($to);
        }

        $mailer = new \Nette\Mail\SmtpMailer($this->smtp['config']);
        $mailer->send($message);
    }
1234016
protected function log($message)
    {
        if ($this->log_handle == null) {
            $this->log_handle = fopen($this->config['logfile'], 'a');
        }
        fwrite($this->log_handle, $message);
    }
1157139
protected function log($message)
    {

        if ($this->debug == true) {
            file_put_contents("php://stdout", $message . "\n");
        }

        file_put_contents($this->dump_dir . 'dump.log', $message . "\n", \FILE_APPEND);
    }
688449
public function warning(string $message)
    {
        if ($this->status == 'ok') {
            $this->status = 'warning';
        }

        $this->warnings[] = $message;
    }
379858
public function log($message)
    {

        if (!empty($this->log_file)) {
            //echo $message;
            \file_put_contents($this->log_file, "\n" . $message, \FILE_APPEND);
        }
    }