| Total Complexity | 4 |
| Total Lines | 44 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 10 | final class ContainerException extends Exception implements ContainerExceptionInterface |
||
| 11 | { |
||
| 12 | 1 | public static function instanceNotExtendable(): self |
|
| 13 | { |
||
| 14 | 1 | $message = <<<TXT |
|
| 15 | The passed instance is not extendable. |
||
| 16 | Only objects, arrays, and callables can be extended. |
||
| 17 | 4 | ||
| 18 | Ensure the service is one of these types before calling extend(). |
||
| 19 | 4 | TXT; |
|
| 20 | return new self($message); |
||
| 21 | } |
||
| 22 | 1 | ||
| 23 | public static function frozenInstanceExtend(string $id): self |
||
| 24 | 1 | { |
|
| 25 | $message = <<<TXT |
||
| 26 | The instance '{$id}' is frozen and cannot be extended. |
||
| 27 | 1 | Services become frozen after being accessed via get() to ensure consistency. |
|
| 28 | |||
| 29 | 1 | Extend the service before accessing it, or use remove() to unfreeze it first. |
|
| 30 | TXT; |
||
| 31 | return new self($message); |
||
| 32 | } |
||
| 33 | |||
| 34 | public static function frozenInstanceOverride(string $id): self |
||
| 43 | } |
||
| 44 | |||
| 45 | public static function instanceProtected(string $id): self |
||
| 54 | } |
||
| 55 | } |
||
| 56 |