| @@ 8-25 (lines=18) @@ | ||
| 5 | use DomainException; |
|
| 6 | use TomPHP\ExceptionConstructorTools\ExceptionConstructorTools; |
|
| 7 | ||
| 8 | final class UnknownFileTypeException extends DomainException implements Exception |
|
| 9 | { |
|
| 10 | use ExceptionConstructorTools; |
|
| 11 | ||
| 12 | /** |
|
| 13 | * @param string $extension |
|
| 14 | * @param string[] $availableExtensions |
|
| 15 | * |
|
| 16 | * @return self |
|
| 17 | */ |
|
| 18 | public static function fromFileExtension($extension, array $availableExtensions) |
|
| 19 | { |
|
| 20 | return self::create( |
|
| 21 | 'No reader configured for "%s" files; readers are available for %s.', |
|
| 22 | [$extension, self::listToString($availableExtensions)] |
|
| 23 | ); |
|
| 24 | } |
|
| 25 | } |
|
| 26 | ||
| @@ 8-25 (lines=18) @@ | ||
| 5 | use DomainException; |
|
| 6 | use TomPHP\ExceptionConstructorTools\ExceptionConstructorTools; |
|
| 7 | ||
| 8 | final class UnknownSettingException extends DomainException implements Exception |
|
| 9 | { |
|
| 10 | use ExceptionConstructorTools; |
|
| 11 | ||
| 12 | /** |
|
| 13 | * @param string $setting |
|
| 14 | * @param string[] $knownSettings |
|
| 15 | * |
|
| 16 | * @return self |
|
| 17 | */ |
|
| 18 | public static function fromSetting($setting, array $knownSettings) |
|
| 19 | { |
|
| 20 | return self::create( |
|
| 21 | 'Setting "%s" is unknown; valid settings are %s.', |
|
| 22 | [$setting, self::listToString($knownSettings)] |
|
| 23 | ); |
|
| 24 | } |
|
| 25 | } |
|
| 26 | ||