Issues (1)

config/di/weather.php (1 issue)

1
<?php
2
/**
3
 * Creating the weather class as a $di service.
4
 */
5
return [
6
    // Services to add to the container.
7
    "services" => [
8
        "weather" => [
9
            "shared" => true,
10
            "callback" => function () {
11
12
                // Load the configuration files
13
                $cfg = $this->get("configuration");
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $this seems to be never defined.
Loading history...
14
                $config = $cfg->load("apikey_sample.php"); // Update with your own apikey file
15
                $config = $config["config"] ?? null;
16
17
                // Create and configure new weather-object
18
                $weather = new \Mahw17\Weather\Weather($config);
19
20
                // Create and configure new ip-object and add to weather service
21
                $weather->setIp(new \Mahw17\Weather\Ip($config));
22
23
                return $weather;
24
            }
25
        ],
26
    ],
27
];
28