Conditions | 3 |
Paths | 3 |
Total Lines | 18 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 11 |
CRAP Score | 3 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
20 | 19 | public function __construct( |
|
21 | private string $id, |
||
22 | private array $buildStack = [], |
||
23 | ?Throwable $previous = null, |
||
24 | ) { |
||
25 | 19 | if (empty($this->buildStack)) { |
|
26 | 3 | $message = sprintf('No definition or class found or resolvable for "%s".', $id); |
|
27 | 16 | } elseif ($this->buildStack === [$id]) { |
|
28 | 11 | $message = sprintf('No definition or class found or resolvable for "%s" while building it.', $id); |
|
29 | } else { |
||
30 | 6 | $message = sprintf( |
|
31 | 6 | 'No definition or class found or resolvable for "%s" while building "%s".', |
|
32 | 6 | end($this->buildStack), |
|
33 | 6 | implode('" -> "', $buildStack), |
|
34 | 6 | ); |
|
35 | } |
||
36 | |||
37 | 19 | parent::__construct($message, previous: $previous); |
|
38 | } |
||
53 |