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