| Conditions | 4 |
| Paths | 3 |
| Total Lines | 13 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 4 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 52 | 4 | public function load(string $template): ?string |
|
| 53 | { |
||
| 54 | 4 | $loadedTemplate = $this->templates[$template] ?? null; |
|
| 55 | |||
| 56 | 4 | if ($loadedTemplate instanceof \Stringable || \is_string($loadedTemplate)) { |
|
| 57 | 4 | return (string) $loadedTemplate; |
|
| 58 | } |
||
| 59 | |||
| 60 | 4 | if (null !== $loadedTemplate) { |
|
|
|
|||
| 61 | 1 | throw new LoaderException(\sprintf('Failed to load "%s" as it\'s source isn\'t stringable.', $template)); |
|
| 62 | } |
||
| 63 | |||
| 64 | 3 | return $loadedTemplate; |
|
| 65 | } |
||
| 67 |