1 | <?php |
||
2 | /** |
||
3 | * Configuration file for DI container. |
||
4 | */ |
||
5 | return [ |
||
6 | |||
7 | // Services to add to the container. |
||
8 | "services" => [ |
||
9 | "openWeatherMap" => [ |
||
10 | // Is the service shared, true or false |
||
11 | // Optional, default is true |
||
12 | "shared" => true, |
||
13 | |||
14 | // Is the service activated by default, true or false |
||
15 | // Optional, default is false |
||
16 | "active" => true, |
||
17 | |||
18 | // Callback executed when service is activated |
||
19 | // Create the service, load its configuration (if any) |
||
20 | // and set it up. |
||
21 | "callback" => function () { |
||
22 | $openWeatherMapModel = new \Moody\weather_and_position\IpValidate(); |
||
23 | |||
24 | |||
25 | // Load the configuration files |
||
26 | $cfg = $this->get("configuration"); |
||
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
![]() |
|||
27 | $config = $cfg->load("weatherToken.php"); |
||
28 | $settings = $config["config"] ?? null; |
||
29 | |||
30 | if ($settings["message"] ?? null) { |
||
31 | $openWeatherMapModel->setMessage($settings["message"]); |
||
32 | } |
||
33 | |||
34 | return $openWeatherMapModel; |
||
35 | } |
||
36 | ], |
||
37 | ], |
||
38 | ]; |
||
39 |