Total Complexity | 3 |
Total Lines | 19 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
11 | final class NotInstantiableWithoutWidgetFactoryInitializationException extends NotInstantiableException implements FriendlyExceptionInterface |
||
12 | { |
||
13 | 1 | public function __construct(private Throwable $previous) |
|
14 | { |
||
15 | 1 | parent::__construct( |
|
16 | 1 | $previous->getMessage() . |
|
17 | 1 | ' Perhaps you need to initialize "' . WidgetFactory::class . '" with DI container to resolve dependencies.', |
|
18 | 1 | previous: $previous, |
|
19 | 1 | ); |
|
20 | } |
||
21 | |||
22 | 1 | public function getName(): string |
|
23 | { |
||
24 | 1 | return 'Failed to create a widget. ' . $this->previous->getMessage(); |
|
25 | } |
||
26 | |||
27 | public function getSolution(): ?string |
||
30 | Perhaps need initialize `WidgetFactory` with container for resolve dependencies. |
||
31 | |||
32 | To initialize the widget factory call `WidgetFactory::initialize()` before using the widget. |
||
60 |