summaryrefslogtreecommitdiffstats
path: root/inc/mailer.inc.php
diff options
context:
space:
mode:
authorSimon Rettberg2023-11-14 14:47:55 +0100
committerSimon Rettberg2023-11-14 14:47:55 +0100
commit06bff0b9b84d47c43f9bc8aff06a29d85ebb7ed0 (patch)
tree7e5493b102074672d8cfd8fe1a61e49f080edbe8 /inc/mailer.inc.php
parentUpdate phpstorm config (diff)
downloadslx-admin-06bff0b9b84d47c43f9bc8aff06a29d85ebb7ed0.tar.gz
slx-admin-06bff0b9b84d47c43f9bc8aff06a29d85ebb7ed0.tar.xz
slx-admin-06bff0b9b84d47c43f9bc8aff06a29d85ebb7ed0.zip
Add function param/return types, fix a lot more phpstorm complaints
Diffstat (limited to 'inc/mailer.inc.php')
-rw-r--r--inc/mailer.inc.php14
1 files changed, 5 insertions, 9 deletions
diff --git a/inc/mailer.inc.php b/inc/mailer.inc.php
index 1545e930..b2fb7741 100644
--- a/inc/mailer.inc.php
+++ b/inc/mailer.inc.php
@@ -93,7 +93,7 @@ class Mailer
return preg_replace('/^\* Expire in \d+ ms for.*[\\r\\n]+(?=\* Expire)/m','$1', $this->errlog);
}
- public static function queue(int $configid, array $rcpts, string $subject, string $text)
+ public static function queue(int $configid, array $rcpts, string $subject, string $text): void
{
foreach ($rcpts as $rcpt) {
Database::exec("INSERT INTO mail_queue (rcpt, subject, body, dateline, configid)
@@ -102,7 +102,7 @@ class Mailer
}
}
- public static function flushQueue()
+ public static function flushQueue(): void
{
$list = Database::queryGroupList("SELECT Concat(configid, rcpt, subject) AS keyval,
mailid, configid, rcpt, subject, body, dateline FROM mail_queue
@@ -167,19 +167,15 @@ class Mailer
return self::$configs[$configId] ?? [];
}
- /**
- * @param int $configId
- * @return Mailer|null
- */
- public static function instanceFromConfig(int $configId)
+ public static function instanceFromConfig(int $configId): ?Mailer
{
$config = self::getConfig($configId);
if (empty($config))
return null;
if ($config['ssl'] === 'IMPLICIT') {
- $uri = "smtps://{$config['host']}:${config['port']}";
+ $uri = "smtps://{$config['host']}:{$config['port']}";
} else {
- $uri = "smtp://{$config['host']}:${config['port']}";
+ $uri = "smtp://{$config['host']}:{$config['port']}";
}
return new Mailer($uri, $config['ssl'] === 'EXPLICIT', $config['senderaddress'], $config['username'],
$config['password'], $config['replyto']);