| Conditions | 3 |
| Paths | 3 |
| Total Lines | 18 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 3.243 |
| Changes | 3 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 27 | 15 | public static function getRender( |
|
| 28 | string $type, |
||
| 29 | Environment $environment, |
||
| 30 | string $render = Assets::RENDER_HTML |
||
| 31 | ): RenderInterface { |
||
| 32 | 15 | if (!array_key_exists($render, self::RENDERS)) { |
|
| 33 | 1 | throw new UnexpectedParameters( |
|
| 34 | 1 | sprintf('Invalid render group. Allowed only: %s', implode(', ', array_keys(self::RENDERS))) |
|
| 35 | 1 | ); |
|
| 36 | } |
||
| 37 | |||
| 38 | 14 | if (null === $renderClass = (self::RENDERS[$render][$type] ?? null)) { |
|
| 39 | throw new UnexpectedParameters( |
||
| 40 | sprintf('Invalid render. Allowed only: %s', implode(', ', array_keys(self::RENDERS[$render]))) |
||
| 41 | ); |
||
| 42 | } |
||
| 43 | |||
| 44 | 14 | return new $renderClass($environment); |
|
| 45 | } |
||
| 47 |