20 lines
464 B
PHP
20 lines
464 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Shared\DDD\Exceptions;
|
|
|
|
use Shared\Enums\Country;
|
|
|
|
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}'");
|
|
}
|
|
}
|