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