Code Coverage |
||||||||||||||||
Lines |
Branches |
Paths |
Functions and Methods |
Classes and Traits |
||||||||||||
| Total | |
100.00% |
7 / 7 |
|
100.00% |
11 / 11 |
|
66.67% |
6 / 9 |
|
100.00% |
4 / 4 |
CRAP | |
100.00% |
1 / 1 |
| RendererEntry | |
100.00% |
7 / 7 |
|
100.00% |
11 / 11 |
|
66.67% |
6 / 9 |
|
100.00% |
4 / 4 |
8.81 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| matches | |
100.00% |
4 / 4 |
|
100.00% |
8 / 8 |
|
50.00% |
3 / 6 |
|
100.00% |
1 / 1 |
6.00 | |||
| log | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| logLevel | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Celemas\Core\Error; |
| 6 | |
| 7 | use Throwable; |
| 8 | |
| 9 | final class RendererEntry |
| 10 | { |
| 11 | private string|int|null $logLevel = null; |
| 12 | |
| 13 | /** |
| 14 | * @param list<class-string<Throwable>> $exceptions |
| 15 | */ |
| 16 | public function __construct( |
| 17 | public readonly array $exceptions, |
| 18 | public readonly Renderer $renderer, |
| 19 | ) {} |
| 20 | |
| 21 | public function matches(Throwable $exception): bool |
| 22 | { |
| 23 | foreach ($this->exceptions as $class) { |
| 24 | if ($exception::class === $class || is_subclass_of($exception::class, $class)) { |
| 25 | return true; |
| 26 | } |
| 27 | } |
| 28 | |
| 29 | return false; |
| 30 | } |
| 31 | |
| 32 | /** @api */ |
| 33 | public function log(string|int $logLevel): void |
| 34 | { |
| 35 | $this->logLevel = $logLevel; |
| 36 | } |
| 37 | |
| 38 | public function logLevel(): string|int|null |
| 39 | { |
| 40 | return $this->logLevel; |
| 41 | } |
| 42 | } |
Below are the source code lines that represent each code branch as identified by Xdebug. Please note a branch is not
necessarily coterminous with a line, a line may contain multiple branches and therefore show up more than once.
Please also be aware that some branches may be implicit rather than explicit, e.g. an if statement
always has an else as part of its logical flow even if you didn't write one.
| 17 | public readonly array $exceptions, |
| 18 | public readonly Renderer $renderer, |
| 19 | ) {} |
| 33 | public function log(string|int $logLevel): void |
| 34 | { |
| 35 | $this->logLevel = $logLevel; |
| 36 | } |
| 40 | return $this->logLevel; |
| 41 | } |
| 21 | public function matches(Throwable $exception): bool |
| 22 | { |
| 23 | foreach ($this->exceptions as $class) { |
| 23 | foreach ($this->exceptions as $class) { |
| 24 | if ($exception::class === $class || is_subclass_of($exception::class, $class)) { |
| 24 | if ($exception::class === $class || is_subclass_of($exception::class, $class)) { |
| 24 | if ($exception::class === $class || is_subclass_of($exception::class, $class)) { |
| 25 | return true; |
| 23 | foreach ($this->exceptions as $class) { |
| 23 | foreach ($this->exceptions as $class) { |
| 24 | if ($exception::class === $class || is_subclass_of($exception::class, $class)) { |
| 25 | return true; |
| 26 | } |
| 27 | } |
| 28 | |
| 29 | return false; |
| 30 | } |