| Total Complexity | 4 |
| Total Lines | 34 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 10 | final class FinalizersException extends ScopeException |
||
| 11 | { |
||
| 12 | /** |
||
| 13 | * @param Throwable[] $exceptions |
||
| 14 | */ |
||
| 15 | public function __construct( |
||
| 16 | ?string $scope, |
||
| 17 | protected array $exceptions, |
||
| 18 | ) { |
||
| 19 | $count = \count($exceptions); |
||
| 20 | parent::__construct( |
||
| 21 | $scope, |
||
| 22 | \sprintf( |
||
| 23 | "%s thrown during finalization of %s:\n%s", |
||
| 24 | $count === 1 ? 'An exception has been' : "$count exceptions have been", |
||
| 25 | $scope === null ? 'an unnamed scope' : "the scope `$scope`", |
||
| 26 | \implode("\n\n", \array_map( |
||
| 27 | static fn (Exception $e): string => \sprintf( |
||
| 28 | "# %s\n%s", |
||
| 29 | $e::class, |
||
| 30 | $e->getMessage(), |
||
| 31 | ), |
||
| 32 | $exceptions, |
||
| 33 | )), |
||
| 34 | ), |
||
| 35 | ); |
||
| 36 | } |
||
| 37 | |||
| 38 | /** |
||
| 39 | * @return Throwable[] |
||
| 40 | */ |
||
| 41 | public function getExceptions(): array |
||
| 44 | } |
||
| 45 | } |
||
| 46 |