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