Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| MailServerNotFoundException | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
| forMailbox | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | /** @license For full copyright and license information, please see the LICENSE.md file. */ |
| 6 | |
| 7 | namespace App\Modules\Mail\Domain\Exception; |
| 8 | |
| 9 | defined('AMMONLY_APP') || exit('Direct script access is forbidden.'); |
| 10 | |
| 11 | use RuntimeException; |
| 12 | |
| 13 | /** |
| 14 | * Exception thrown when a mail server configuration is not found. |
| 15 | * |
| 16 | * @package App\Modules\Mail\Domain\Exception |
| 17 | */ |
| 18 | final class MailServerNotFoundException extends RuntimeException |
| 19 | { |
| 20 | /** |
| 21 | * Creates an instance for missing mail server configuration. |
| 22 | * |
| 23 | * @param int $serverId Mail server identifier. |
| 24 | * @param string $mailboxEmail Mailbox address. |
| 25 | * @return self New exception instance. |
| 26 | */ |
| 27 | public static function forMailbox(int $serverId, string $mailboxEmail): self |
| 28 | { |
| 29 | return new self( |
| 30 | sprintf('Mail server ID %d not found for mailbox %s', $serverId, $mailboxEmail) |
| 31 | ); |
| 32 | } |
| 33 | } |