feat : mise à jour de la structure du projet
This commit is contained in:
10
src/Shared/Domain/Contract/TenantAwareInterface.php
Normal file
10
src/Shared/Domain/Contract/TenantAwareInterface.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Shared\Domain\Contract;
|
||||
|
||||
interface TenantAwareInterface
|
||||
{
|
||||
public function getTenantId(): ?string;
|
||||
}
|
||||
10
src/Shared/Domain/Contract/UserResolverInterface.php
Normal file
10
src/Shared/Domain/Contract/UserResolverInterface.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Shared\Domain\Contract;
|
||||
|
||||
interface UserResolverInterface
|
||||
{
|
||||
public function resolve(int $id): ?object;
|
||||
}
|
||||
12
src/Shared/Domain/Event/DomainEventInterface.php
Normal file
12
src/Shared/Domain/Event/DomainEventInterface.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Shared\Domain\Event;
|
||||
|
||||
use DateTimeImmutable;
|
||||
|
||||
interface DomainEventInterface
|
||||
{
|
||||
public function occurredAt(): DateTimeImmutable;
|
||||
}
|
||||
31
src/Shared/Domain/ValueObject/Email.php
Normal file
31
src/Shared/Domain/ValueObject/Email.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Shared\Domain\ValueObject;
|
||||
|
||||
use InvalidArgumentException;
|
||||
|
||||
final readonly class Email
|
||||
{
|
||||
public readonly string $value;
|
||||
|
||||
public function __construct(string $value)
|
||||
{
|
||||
if (!filter_var($value, FILTER_VALIDATE_EMAIL)) {
|
||||
throw new InvalidArgumentException(sprintf('"%s" is not a valid email address.', $value));
|
||||
}
|
||||
|
||||
$this->value = $value;
|
||||
}
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
return $this->value;
|
||||
}
|
||||
|
||||
public function equals(self $other): bool
|
||||
{
|
||||
return $this->value === $other->value;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user