accounts/common/notifications/AccountDeletedNotification.php
ErickSkrauch 5fc97fdd7a Implemented oauth session revocation notification.
Reworked webhooks notifications constructors
2020-10-01 01:40:28 +03:00

34 lines
878 B
PHP

<?php
declare(strict_types=1);
namespace common\notifications;
use common\models\Account;
use Webmozart\Assert\Assert;
final class AccountDeletedNotification implements NotificationInterface {
private Account $account;
public function __construct(Account $account) {
Assert::notNull($account->deleted_at, 'Account must be deleted');
$this->account = $account;
}
public static function getType(): string {
return 'account.deletion';
}
public function getPayloads(): array {
return [
'id' => $this->account->id,
'uuid' => $this->account->uuid,
'username' => $this->account->username,
'email' => $this->account->email,
'registered' => date('c', $this->account->created_at),
'deleted' => date('c', $this->account->deleted_at),
];
}
}