2026-09-25 10:24:35 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
2026-09-25 16:21:20 +02:00
|
|
|
namespace Shared\DDD\Exceptions;
|
2026-09-25 10:24:35 +02:00
|
|
|
|
2026-09-25 16:21:20 +02:00
|
|
|
use Shared\Enums\Country;
|
2026-09-25 10:24:35 +02:00
|
|
|
|
|
|
|
|
final class UnknownCountryIsoCodeException extends \DomainException
|
|
|
|
|
{
|
|
|
|
|
public static function fromIsoCode(string $isoCode): self
|
|
|
|
|
{
|
|
|
|
|
return new self("No country found for ISO code '{$isoCode}'");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static function fromCountry(Country $country): self
|
|
|
|
|
{
|
|
|
|
|
return new self("No ISO code found for country '{$country->name}'");
|
|
|
|
|
}
|
|
|
|
|
}
|