| Conditions | 4 |
| Paths | 4 |
| Total Lines | 21 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 11 |
| CRAP Score | 4 |
| Changes | 0 | ||
| 1 | <?php |
||
| 22 | 27 | public function create($value): Page |
|
| 23 | { |
||
| 24 | 27 | $id = $value['id'] ?? null; |
|
| 25 | |||
| 26 | 27 | if (! $id) { |
|
| 27 | 1 | throw InvalidConfiguration::pageIdMissing($value); |
|
| 28 | } |
||
| 29 | |||
| 30 | 26 | $template = $value['template'] ?? null; |
|
| 31 | 26 | $variables = $value['variables'] ?? []; |
|
| 32 | |||
| 33 | 26 | if (! $template) { |
|
| 34 | 1 | throw InvalidConfiguration::pageTemplateMissing($id); |
|
| 35 | } |
||
| 36 | |||
| 37 | 25 | foreach ($variables as $key => $variable) { |
|
| 38 | 22 | $variables[$key] = $this->variableParser->parse($variable); |
|
| 39 | } |
||
| 40 | |||
| 41 | 25 | return Page::make($id, $template, $variables); |
|
| 42 | } |
||
| 43 | } |
||
| 44 |