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