Send message to PHP Console connector
@param Message $message
194334
protected function sendMessage(Message $message) {
		if(!$this->isIgnored($message)) {
			parent::sendMessage($message);
			$this->sentMessages[] = $message;
		}
	}
300443
public function transmission(Message $message)
    {
        if (!$this->pusher) {
            return false;
        }

        $sender = $message->sender->toArray();
        $messageArray = $message->toArray();
        $messageArray['sender'] = $sender;
        $this->dispatch(new Webcast($messageArray));
    }
279675
public function sendMessage( $message )
	{
		if( !$this->receiver )
			throw new RuntimeException( 'No Receiver set.' );
		$this->sendMessageTo( $message, $this->receiver->get() );
	}
874728
protected function sending(Message $message)
    {
        $phpMailer = new PHPMailer();
        $phpMailer->isSMTP();
        $phpMailer->SMTPDebug = $this->config[ 'debug' ];

        $host = $this->config[ 'host' ];

        if (is_array($this->config[ 'host' ])) {
            $host = implode(';', $this->config[ 'host' ]);
        }

        $phpMailer->Host = $host;
        $phpMailer->SMTPAuth = $this->config[ 'auth' ];
        $phpMailer->Username = $this->config[ 'username' ];
        $phpMailer->Password = $this->config[ 'password' ];
        $phpMailer->SMTPSecure = $this->config[ 'encryption' ];
        $phpMailer->Port = $this->config[ 'port' ];

        // Set from
        if (false !== ($from = $message->getFrom())) {
            $phpMailer->setFrom($from->getEmail(), $from->getName());
        }

        // Set recipient
        if (false !== ($to = $message->getTo())) {
            foreach ($to as $address) {
                if ($address instanceof Address) {
                    $phpMailer->addAddress($address->getEmail(), $address->getName());
                }
            }
        }

        // Set reply-to
        if (false !== ($replyTo = $message->getReplyTo())) {
            $phpMailer->addReplyTo($replyTo->getEmail(), $replyTo->getName());
        }

        // Set content-type
        if ($message->getContentType() === 'html') {
            $phpMailer->isHTML(true);
        }

        // Set subject, body & alt-body
        $phpMailer->Subject = $message->getSubject();
        $phpMailer->Body = $message->getBody();
        $phpMailer->AltBody = $message->getAltBody();

        if (false !== ($attachments = $message->getAttachments())) {
            foreach ($attachments as $filename => $attachment) {
                $phpMailer->addAttachment($attachment, $filename);
            }
        }

        if ( ! $phpMailer->send()) {
            $this->addError(100, $phpMailer->ErrorInfo);

            return false;
        }

        return true;
    }
725770
public function send(MailMessage $message)
    {
        $this->headers->add(new Header('From', $message->getFrom()));

        $this->mailer->send($message, $this->headers);
    }
857664
public function push(Message $message)
    {
        $profilingEvent = $this->clientProfiler->startProfiling(sprintf('GcmClient::push(%s)', $message->getPayloadAsJson()));

        try {
            parent::push($message);

            $this->clientProfiler->stopProfiling($profilingEvent, array(
                'error' => false,
                'error_message' => null,
            ));

        } catch (\Exception $e) {
            $this->clientProfiler->stopProfiling($profilingEvent, array(
                'error' => true,
                'error_message' => $e->getMessage(),
            ));

            throw $e;
        }
    }
165140
protected function sendSwiftMessage($message)
    {
        if ($this->events) {
            $this->events->dispatch('mailer.sending', array($message));
        }

        if (! $this->pretending) {
            try {
                $this->swift->send($message, $this->failedRecipients);
            }
            finally {
                $this->swift->getTransport()->stop();
            }
        }

        // In the pretending mode.
        else if (isset($this->logger)) {
            $this->logMessage($message);
        }
    }
185452
private function SendMessage($message)
    {
        $this->signal_data->message = $message;
        
        $this->Send(
            \Peg\Lib\Signals\Type\Definitions::IMPORT_MESSAGE,
            $this->signal_data
        );
    }
243383
public function dispatch(Message $message): void
    {
        $this->messages[] = $message;

        // Add message to debug log.
        $context = $message->context ?? [];
        $this->logger->debug($message->message, $context);
    }
758292
protected function appendMessage(Message $message): void
    {
        $this->messages[] = $message;

        if (sizeof($this->messages) > 100) {
            array_shift($this->messages);
        }
    }
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)
            );
        }
    }
841353
public function message($to, $message)
    {
        $this->logger->info(sprintf('Sending a message ["%s"] to %s', $message, $to));

        return call_user_func_array([$this->wrapped, 'message'], func_get_args());
    }
613568
public function sendMessage($message)
    {
        if ($payload = $this->getJsonPayload($message)) {
            $response = $this->getHttpClient()
                ->post($this->getWebhook(), [
                    'headers' => ['Content-Type' => 'application/json'],
                    'body' => $payload,
                ]);

            return 200 === $response->getStatusCode();
        }

        return false;
    }
1328175
public function addMessage(Message $message)
    {
        $message->setMessageBroker($this);
        $this->messages->attach($message);
    }
974604
public function logMessage(Message $message): void
    {
        if (in_array($message->getLevel(), $this->config['log'])) {
            // If script is running for very long time (e.g. CRON), then date might change if time passes midnight.
            // In that case, log will continue to write messages to new file.

            $fpFile = $this->getFileName();
            if ($fpFile !== $this->fpFile) {
                //date has changed? or we need to init?
                if ($this->fp) {
                    // close pointer to old file
                    @fclose($this->fp);
                }

                if ($this->config['path'] === null) {
                    $path = Application::getStoragePath('log' . DS . $fpFile);
                } else {
                    $path = str_replace(DS . DS, DS, $this->config['path'] . DS . $fpFile);
                }

                $this->fpFile = $fpFile;

                if (!($this->fp = @fopen($path, 'a'))) {
                    // file failed to open, maybe directory doesn't exists?
                    $dir = dirname($path);
                    if (!is_dir($dir)) {
                        Directory::mkdir($dir, $this->mode);
                    }

                    if (!($this->fp = @fopen($path, 'a'))) {
                        // now the directory should exists, so try to open file again
                        throw new Exception('Can not write to log file on path=' . $path);
                    }
                }
            }

            if (!$this->fp || $this->fp === null) {
                if ($this->config['path'] === null) {
                    $path = Application::getStoragePath('log' . DS . $fpFile);
                } else {
                    $path = str_replace(DS . DS, DS, $this->config['path'] . DS . $fpFile);
                }

                throw new Exception("Can not write to log file path={$path}");
            }

            if ($this->getMessageFunction !== null) {
                $line = call_user_func($this->getMessageFunction, $message);
            } else {
                $time = $message->getTime()->format('y-m-d H:i:s.v');
                $level = strtoupper($message->getLevel());
                $space = str_repeat(' ', 10 - strlen($level));
                $who = $message->getWho() ?? Log::getWho();
                $line = "{$time} {$level}{$space}{$who}\t{$message->getMessage()}\n";
            }

            if (!@fwrite($this->fp, $line)) { // actually write it in file
                throw new Exception('Unable to write to log file');
            }
        }
    }
457030
final public function send($message)
    {

        $response = $this->client()->{$this->config->getRequestMethod()}($this->config->getMessageUri(), array_merge(
                $this->config->getProviderConfig(), [
                    'command' => 'send',
                    'to' => $this->recipient,
                    'message' => $message,
                ])
        );

        return $this->getResponse($response);
    }
717434
public function console($message, $eolBefor = false)
    {
        $befor = '';
        if ($eolBefor) {
            $befor = PHP_EOL;
        }

        echo $befor, $message, PHP_EOL;
        return $this;
    }