| Total Complexity | 5 |
| Total Lines | 38 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 11 | class FinalizersException extends ContainerException |
||
| 12 | { |
||
| 13 | /** |
||
| 14 | * @param Throwable[] $exceptions |
||
| 15 | */ |
||
| 16 | public function __construct( |
||
| 17 | protected ?string $scope, |
||
| 18 | protected array $exceptions, |
||
| 19 | ) { |
||
| 20 | $count = \count($exceptions); |
||
| 21 | parent::__construct( |
||
| 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 | public function getScope(): ?string |
||
| 39 | { |
||
| 40 | return $this->scope; |
||
| 41 | } |
||
| 42 | |||
| 43 | /** |
||
| 44 | * @return Throwable[] |
||
| 45 | */ |
||
| 46 | public function getExceptions(): array |
||
| 49 | } |
||
| 50 | } |
||
| 51 |