update email template
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace App\Integrations\Domain\Transformers;
|
||||
|
||||
use App\Integrations\Domain\DTOs\DnsDomainUserData;
|
||||
use App\Integrations\Domain\Support\DnsDomainIdResolver;
|
||||
use App\Integrations\Domain\Support\DomainUserResolver;
|
||||
|
||||
class DnsDomainUserTransformer
|
||||
{
|
||||
public function __construct(
|
||||
private DnsDomainIdResolver $domains,
|
||||
private DomainUserResolver $users,
|
||||
) {
|
||||
}
|
||||
|
||||
public function transform(array|object $row): DnsDomainUserData
|
||||
{
|
||||
$row = (array) $row;
|
||||
|
||||
return new DnsDomainUserData(
|
||||
domainId: $this->domains->resolve((int) $row['domain_id']),
|
||||
customerId: $this->users->resolve((int) $row['user_id']),
|
||||
createdAt: $this->nullableDate($row['created_at'] ?? null),
|
||||
updatedAt: $this->nullableDate($row['updated_at'] ?? null),
|
||||
);
|
||||
}
|
||||
|
||||
private function nullableDate(?string $value): ?string
|
||||
{
|
||||
if (! $value || (int) substr($value, 0, 4) < 1970) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user