This commit is contained in:
Mateusz Pieła 2021-04-27 00:04:19 +02:00
parent 3f7f9ce7e6
commit 73f3eb8178
4 changed files with 30 additions and 34 deletions

View file

@ -1,10 +1,10 @@
<?php
namespace Classes;
namespace classes;
use Norgul\Xmpp\Options;
use Norgul\Xmpp\XmppClient;
class Xmpp extends Core{
class xmpp extends core{
private $xmpp_options;
private $xmpp_client;
@ -14,7 +14,7 @@ class Xmpp extends Core{
$this->xmpp_options = new Options();
}
public function start()
public function start(): void
{
$this->xmpp_options->setHost($this->config->xmpp_server);
$this->xmpp_options->setUseTls($this->config->xmpp_tls);
@ -23,12 +23,12 @@ class Xmpp extends Core{
$this->xmpp_client = new XmppClient($this->xmpp_options);
}
public function connect()
public function connect(): void
{
$this->xmpp_client->connect();
}
public function sendMessage(string $text)
public function sendMessage(string $text): void
{
foreach($this->config->xmpp_recipients as $receipient)
{
@ -42,7 +42,7 @@ class Xmpp extends Core{
}
}
private function getChatType(int $type)
private function getChatType(int $type): string
{
if($type === 1)
{
@ -60,7 +60,7 @@ class Xmpp extends Core{
return $return_type;
}
public function disconnect()
public function disconnect(): void
{
$this->xmpp_client->disconnect();
}