Lines
0.00%
0 / 6
Functions and Methods
0.00%
0 / 6
Classes and Traits
0.00%
0 / 1
| Name | Lines | Functions and Methods | CRAP | Classes and Traits | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| ExposureException | 0.00% | 0 / 6 | 0.00% | 0 / 6 | 42 | 0.00% | 0 / 1 | |||
| outsideApp | 0.00% | 0 / 1 | 0.00% | 0 / 1 | 2 | |||||
| keyTaken | 0.00% | 0 / 1 | 0.00% | 0 / 1 | 2 | |||||
| configInvalid | 0.00% | 0 / 1 | 0.00% | 0 / 1 | 2 | |||||
| stateInvalid | 0.00% | 0 / 1 | 0.00% | 0 / 1 | 2 | |||||
| removed | 0.00% | 0 / 1 | 0.00% | 0 / 1 | 2 | |||||
| unreachable | 0.00% | 0 / 1 | 0.00% | 0 / 1 | 2 | |||||
| 1 | <?php | |
| 2 | ||
| 3 | declare(strict_types=1); | |
| 4 | ||
| 5 | namespace Stewart\Contracts\Exception; | |
| 6 | ||
| 7 | use Stewart\Contracts\App\AppId; | |
| 8 | use Stewart\Contracts\Exposure\ExposedEntityKey; | |
| 9 | use Throwable; | |
| 10 | ||
| 11 | /** @extends StewartException<ExposureError> */ | |
| 12 | final class ExposureException extends StewartException | |
| 13 | { | |
| 14 | public static function outsideApp(ExposedEntityKey $key): self | |
| 15 | { | |
| 16 | return self::createForReason(ExposureError::OutsideApp, key: $key->value); | |
| 17 | } | |
| 18 | ||
| 19 | public static function keyTaken(AppId $appId, ExposedEntityKey $key): self | |
| 20 | { | |
| 21 | return self::createForReason(ExposureError::KeyTaken, appId: $appId->value, key: $key->value); | |
| 22 | } | |
| 23 | ||
| 24 | public static function configInvalid(string $detail): self | |
| 25 | { | |
| 26 | return self::createForReason(ExposureError::ConfigInvalid, detail: $detail); | |
| 27 | } | |
| 28 | ||
| 29 | public static function stateInvalid(string $detail): self | |
| 30 | { | |
| 31 | return self::createForReason(ExposureError::StateInvalid, detail: $detail); | |
| 32 | } | |
| 33 | ||
| 34 | public static function removed(ExposedEntityKey $key): self | |
| 35 | { | |
| 36 | return self::createForReason(ExposureError::Removed, key: $key->value); | |
| 37 | } | |
| 38 | ||
| 39 | public static function unreachable(ExposedEntityKey $key, string $detail, ?Throwable $previous = null): self | |
| 40 | { | |
| 41 | return self::createForReason(ExposureError::Unreachable, $previous, key: $key->value, detail: $detail); | |
| 42 | } | |
| 43 | } |