death-notifier/src/main/php/com/fwdekker/deathnotifier/mailer/Email.php

60 lines
1.7 KiB
PHP

<?php
namespace com\fwdekker\deathnotifier\mailer;
use com\fwdekker\deathnotifier\IllegalStateException;
use com\fwdekker\deathnotifier\tracking\NotifyArticleDeletedEmail;
use com\fwdekker\deathnotifier\tracking\NotifyArticleUndeletedEmail;
use com\fwdekker\deathnotifier\tracking\NotifyStatusChangedEmail;
use com\fwdekker\deathnotifier\user\ChangedEmailEmail;
use com\fwdekker\deathnotifier\user\ChangedPasswordEmail;
use com\fwdekker\deathnotifier\user\RegisterEmail;
use com\fwdekker\deathnotifier\user\ResetPasswordEmail;
use com\fwdekker\deathnotifier\user\VerifyEmailEmail;
use JsonSerializable;
/**
* An email that can be queued in a database and then sent.
*/
abstract class Email
{
/**
* @var string a string identifying the type of email and distinguishing it from similar instances of the same type
*/
public readonly string $type_key;
/**
* @var string the intended recipient of the email
*/
public readonly string $recipient;
/**
* Constructs a new email.
*
* @param string $type_key a string identifying the type of email and distinguishing it from similar instances of
* the same type
* @param string $recipient the intended recipient of the email
*/
public function __construct(string $type_key, string $recipient)
{
$this->type_key = $type_key;
$this->recipient = $recipient;
}
/**
* Returns the subject header of the email.
*
* @return string the subject header of the email
*/
public abstract function get_subject(): string;
/**
* Returns the body of the email.
*
* @return string the body of the email
*/
public abstract function get_body(): string;
}