| Total Complexity | 5 |
| Total Lines | 55 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 12 | class ChainedExceptionHandler implements ExceptionHandler |
||
| 13 | { |
||
| 14 | |||
| 15 | /** |
||
| 16 | * @var ExceptionHandler |
||
| 17 | */ |
||
| 18 | private $primaryHandler; |
||
| 19 | |||
| 20 | /** |
||
| 21 | * @var ExceptionHandler[] |
||
| 22 | */ |
||
| 23 | private $secondaryHandlers; |
||
| 24 | |||
| 25 | |||
| 26 | /** |
||
| 27 | * ChainedExceptionHandler constructor. |
||
| 28 | * |
||
| 29 | * @param ExceptionHandler $primaryHandler |
||
| 30 | * @param ExceptionHandler[] $secondaryHandlers (optional) |
||
| 31 | */ |
||
| 32 | public function __construct(ExceptionHandler $primaryHandler, array $secondaryHandlers = []) |
||
| 33 | { |
||
| 34 | $this->primaryHandler = $primaryHandler; |
||
| 35 | $this->secondaryHandlers = $secondaryHandlers; |
||
| 36 | } |
||
| 37 | |||
| 38 | |||
| 39 | /** |
||
| 40 | * @inheritdoc |
||
| 41 | */ |
||
| 42 | public function report(Exception $e) |
||
| 43 | { |
||
| 44 | $this->primaryHandler->report($e); |
||
| 45 | |||
| 46 | foreach ($this->secondaryHandlers as $handler) { |
||
| 47 | $handler->report($e); |
||
| 48 | } |
||
| 49 | } |
||
| 50 | |||
| 51 | |||
| 52 | /** |
||
| 53 | * @inheritdoc |
||
| 54 | */ |
||
| 55 | public function render($request, Exception $e) |
||
| 56 | { |
||
| 57 | return $this->primaryHandler->render($request, $e); |
||
| 58 | } |
||
| 59 | |||
| 60 | |||
| 61 | /** |
||
| 62 | * @inheritdoc |
||
| 63 | */ |
||
| 64 | public function renderForConsole($output, Exception $e) |
||
| 67 | } |
||
| 68 | |||
| 69 | } |
||
| 70 |