Skip to content

Instantly share code, notes, and snippets.

View BackEndTea's full-sized avatar

Gert de Pagter BackEndTea

View GitHub Profile
@BackEndTea
BackEndTea / Email.php
Created December 2, 2022 11:41
VO with possible invalid state
<?php
namespace Email;
interface EmailAddress {
public function isValid(): bool;
public function asString(): string;
}
class ValidEmailAddress implements EmailAddress {
<?php
class WebsiteContext{}
class WrongSendMail
{
public function __construct(private WebsiteContext $website) {}
public function send(int $emailId) {}
<?php
use Psr\SimpleCache\CacheInterface;
interface Api {
public function get(array $data): mixed;
}
class CachedApi implements Api
{