Conditions | 5 |
Paths | 6 |
Total Lines | 24 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
22 | public function __invoke(array $post) { |
||
23 | |||
24 | # Define errors list |
||
25 | |||
26 | $errors = []; |
||
27 | |||
28 | $errors['system_url'] = 'SETTINGS_ERROR_SYSTEM_URL'; |
||
29 | $errors['system_email'] = 'SETTINGS_ERROR_SYSTEM_EMAIL'; |
||
30 | |||
31 | # Process post data |
||
32 | |||
33 | foreach (Settings::setArray($post) as $name => $result) { |
||
34 | |||
35 | if (!$result) return (isset($errors[$name]) ? [$name, $errors[$name]] : false); |
||
36 | } |
||
37 | |||
38 | # Save settings |
||
39 | |||
40 | if (!Settings::save()) return 'SETTINGS_ERROR_SAVE'; |
||
41 | |||
42 | # ------------------------ |
||
43 | |||
44 | return true; |
||
45 | } |
||
46 | } |
||
48 |