Refactored the EntityId class to include UUID v7 validation in the constructor, ensuring all derived classes inherit this behavior.
72 lines
2 KiB
PHP
72 lines
2 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Domain\Models\ValueObjects;
|
|
|
|
use Domain\Enums\Country;
|
|
|
|
/**
|
|
* @phpstan-type CrmCustomerArray array{
|
|
* hashcode: ?string,
|
|
* email: ?string,
|
|
* password: ?string,
|
|
* firstname: ?string,
|
|
* lastname: ?string,
|
|
* birthDate: ?string,
|
|
* phone: ?string,
|
|
* address: ?string,
|
|
* address2: ?string,
|
|
* city: ?string,
|
|
* postcode: ?string,
|
|
* country: \Domain\Enums\Country,
|
|
* optIn: bool,
|
|
* status: bool,
|
|
* lastConnection: ?\DateTimeInterface
|
|
* }
|
|
*/
|
|
final readonly class CrmCustomer
|
|
{
|
|
public function __construct(
|
|
public ?string $hashcode,
|
|
public ?string $email,
|
|
public ?string $password,
|
|
public ?string $firstname,
|
|
public ?string $lastname,
|
|
public ?string $birthDate,
|
|
public ?string $phone,
|
|
public ?string $address,
|
|
public ?string $address2,
|
|
public ?string $city,
|
|
public ?string $postcode,
|
|
public Country $country,
|
|
public bool $optIn,
|
|
public bool $status,
|
|
public ?\DateTimeInterface $lastConnection,
|
|
) {
|
|
}
|
|
|
|
/**
|
|
* @return CrmCustomerArray
|
|
*/
|
|
public function toArray(): array
|
|
{
|
|
return [
|
|
'hashcode' => $this->hashcode,
|
|
'email' => $this->email,
|
|
'password' => $this->password,
|
|
'firstname' => $this->firstname,
|
|
'lastname' => $this->lastname,
|
|
'birthDate' => $this->birthDate,
|
|
'phone' => $this->phone,
|
|
'address' => $this->address,
|
|
'address2' => $this->address2,
|
|
'city' => $this->city,
|
|
'postcode' => $this->postcode,
|
|
'country' => $this->country,
|
|
'optIn' => $this->optIn,
|
|
'status' => $this->status,
|
|
'lastConnection' => $this->lastConnection,
|
|
];
|
|
}
|
|
}
|