Files
fossbilling-mailgateway/NotificationEmailProxy.php
T

31 lines
897 B
PHP

<?php
declare(strict_types=1);
namespace Box\Mod\Mailgateway;
/** Used only while Support creates a ticket for an imported message. */
class NotificationEmailProxy
{
public function __construct(private object $email, private \Closure $acknowledge) {}
public function sendTemplate(array $data): mixed
{
if (($data['code'] ?? '') === 'mod_support_ticket_open') {
return ($this->acknowledge)($data);
}
// The canned reply remains in the ticket. Send the ticket-number
// acknowledgement instead of a second automatic canned-reply email.
if (($data['code'] ?? '') === 'mod_support_ticket_staff_reply') {
return false;
}
return $this->email->sendTemplate($data);
}
public function __call(string $method, array $arguments): mixed
{
return $this->email->$method(...$arguments);
}
}