Lines
100.00%
4 / 4
Functions and Methods
100.00%
2 / 2
Classes and Traits
100.00%
1 / 1
| Name | Lines | Functions and Methods | CRAP | Classes and Traits | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| UnsupportedBankException | 100.00% | 4 / 4 | 100.00% | 2 / 2 | 3 | 100.00% | 1 / 1 | |||
| noParserFound | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | |||||
| withSender | 100.00% | 3 / 3 | 100.00% | 1 / 1 | 2 | |||||
| 1 | <?php | |
| 2 | ||
| 3 | declare(strict_types=1); | |
| 4 | ||
| 5 | namespace Tomaj\BankMailsParser\Exception; | |
| 6 | ||
| 7 | /** | |
| 8 | * Thrown when no parser can handle the provided email content. | |
| 9 | */ | |
| 10 | final class UnsupportedBankException extends ParseException | |
| 11 | { | |
| 12 | public static function noParserFound(): self | |
| 13 | { | |
| 14 | return new self('No parser found that supports this email format. The email may be from an unsupported bank or have an unrecognized format.'); | |
| 15 | } | |
| 16 | ||
| 17 | public static function withSender(?string $sender): self | |
| 18 | { | |
| 19 | if ($sender !== null) { | |
| 20 | return new self('No parser found for the supplied sender.'); | |
| 21 | } | |
| 22 | ||
| 23 | return self::noParserFound(); | |
| 24 | } | |
| 25 | } |