| @@ 16-47 (lines=32) @@ | ||
| 13 | ||
| 14 | use RuntimeException; |
|
| 15 | ||
| 16 | abstract class FormatterExceptionAbstract extends RuntimeException |
|
| 17 | { |
|
| 18 | /** |
|
| 19 | * @param \Exception|null $e An optional previous Exception |
|
| 20 | * |
|
| 21 | * @return static |
|
| 22 | */ |
|
| 23 | public static function msg( |
|
| 24 | \Exception $e = null |
|
| 25 | ) { |
|
| 26 | return new static( |
|
| 27 | static::MSG_MESSAGE, |
|
| 28 | static::MSG_CODE, |
|
| 29 | $e |
|
| 30 | ); |
|
| 31 | } |
|
| 32 | ||
| 33 | /** |
|
| 34 | * @param \Exception|null $e An optional previous Exception |
|
| 35 | * |
|
| 36 | * @return static |
|
| 37 | */ |
|
| 38 | public static function level( |
|
| 39 | \Exception $e = null |
|
| 40 | ) { |
|
| 41 | return new static( |
|
| 42 | static::LEVEL_MESSAGE, |
|
| 43 | static::LEVEL_CODE, |
|
| 44 | $e |
|
| 45 | ); |
|
| 46 | } |
|
| 47 | } |
|
| 48 | ||
| @@ 19-50 (lines=32) @@ | ||
| 16 | /** |
|
| 17 | * Trait FormatterStartExceptionTrait. |
|
| 18 | */ |
|
| 19 | trait FormatterExceptionTrait |
|
| 20 | { |
|
| 21 | /** |
|
| 22 | * @param \Exception|null $e An optional previous Exception |
|
| 23 | * |
|
| 24 | * @return static |
|
| 25 | */ |
|
| 26 | public static function msg( |
|
| 27 | Exception $e = null |
|
| 28 | ) { |
|
| 29 | return new static( |
|
| 30 | self::MSG_MESSAGE, |
|
| 31 | self::MSG_CODE, |
|
| 32 | $e |
|
| 33 | ); |
|
| 34 | } |
|
| 35 | ||
| 36 | /** |
|
| 37 | * @param \Exception|null $e An optional previous Exception |
|
| 38 | * |
|
| 39 | * @return static |
|
| 40 | */ |
|
| 41 | public static function level( |
|
| 42 | Exception $e = null |
|
| 43 | ) { |
|
| 44 | return new static( |
|
| 45 | self::LEVEL_MESSAGE, |
|
| 46 | self::LEVEL_CODE, |
|
| 47 | $e |
|
| 48 | ); |
|
| 49 | } |
|
| 50 | } |
|
| 51 | ||