Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
9 / 9 |
|
100.00% |
3 / 3 |
CRAP | |
100.00% |
1 / 1 |
| AbstractDomainException | |
100.00% |
9 / 9 |
|
100.00% |
3 / 3 |
3 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getContext | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| toArray | |
100.00% |
7 / 7 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | // ╔════════════════════════════════════════════════════════════╗ |
| 4 | // ║ MIT Licence (#Expat) - https://opensource.org/licenses/MIT ║ |
| 5 | // ║ Copyright 2026 Frederic Poeydomenge <dyno@phexium.com> ║ |
| 6 | // ╚════════════════════════════════════════════════════════════╝ |
| 7 | |
| 8 | declare(strict_types=1); |
| 9 | |
| 10 | namespace Phexium\Domain\Exception; |
| 11 | |
| 12 | use DomainException; |
| 13 | use Throwable; |
| 14 | |
| 15 | abstract class AbstractDomainException extends DomainException implements DomainExceptionInterface |
| 16 | { |
| 17 | public function __construct( |
| 18 | string $message = '', |
| 19 | private readonly array $context = [], |
| 20 | int $code = 0, |
| 21 | ?Throwable $previous = null, |
| 22 | ) { |
| 23 | parent::__construct($message, $code, $previous); |
| 24 | } |
| 25 | |
| 26 | public function getContext(): array |
| 27 | { |
| 28 | return $this->context; |
| 29 | } |
| 30 | |
| 31 | public function toArray(): array |
| 32 | { |
| 33 | return [ |
| 34 | 'message' => $this->getMessage(), |
| 35 | 'context' => $this->getContext(), |
| 36 | 'code' => $this->getCode(), |
| 37 | 'file' => $this->getFile(), |
| 38 | 'line' => $this->getLine(), |
| 39 | ]; |
| 40 | } |
| 41 | } |