Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
5 / 5 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
| RuntimeException | |
100.00% |
5 / 5 |
|
100.00% |
2 / 2 |
4 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
3 | |||
| location | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Celemas\Boiler\Exception; |
| 6 | |
| 7 | use Celemas\Boiler\Location; |
| 8 | use Throwable; |
| 9 | |
| 10 | class RuntimeException extends \RuntimeException implements TemplateException |
| 11 | { |
| 12 | public function __construct( |
| 13 | string $message = '', |
| 14 | int $code = 0, |
| 15 | ?Throwable $previous = null, |
| 16 | private readonly ?Location $location = null, |
| 17 | ) { |
| 18 | parent::__construct($message, $code, $previous); |
| 19 | |
| 20 | if ($location !== null && $location->line !== null) { |
| 21 | $this->file = $location->path; |
| 22 | $this->line = $location->line; |
| 23 | } |
| 24 | } |
| 25 | |
| 26 | /** @api */ |
| 27 | public function location(): ?Location |
| 28 | { |
| 29 | return $this->location; |
| 30 | } |
| 31 | } |