Issues (36)

config/di/weather_prog.php (3 issues)

1
<?php
2
/**
3
 * Configuration file for Weather
4
 */
5
return [
6
    // Services to add to the container.
7
    "services" => [
8
        "weather_prog" => [
9
            "shared" => true,
10
            "callback" => function () {
11
                $weatherProg = new \Hepa19\Weather\WeatherModel();
12
                $curl = new \Hepa19\Curl\Curl();
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
15
                if (file_exists(ANAX_INSTALL_PATH . "/config/api_weatherprog_config.php")) {
16
                    $config = $cfg->load("api_weatherprog_config.php");
17
                    $key = $config["config"]["apiKey"] ?? null;
18
                    $baseUrl = $config["config"]["baseUrl"] ?? null;
19
                    $options = $config["config"]["options"] ?? null;
20
                    $weatherProg->setCurl($curl);
21
                    $weatherProg->setApiKey($key);
22
                    $weatherProg->setBaseUrl($baseUrl);
0 ignored issues
show
It seems like $baseUrl can also be of type null; however, parameter $baseUrl of Hepa19\Weather\WeatherModel::setBaseUrl() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

22
                    $weatherProg->setBaseUrl(/** @scrutinizer ignore-type */ $baseUrl);
Loading history...
23
                    $weatherProg->setUrlOptions($options);
0 ignored issues
show
It seems like $options can also be of type null; however, parameter $urlOptions of Hepa19\Weather\WeatherModel::setUrlOptions() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

23
                    $weatherProg->setUrlOptions(/** @scrutinizer ignore-type */ $options);
Loading history...
24
                }
25
26
                return $weatherProg;
27
            }
28
        ],
29
    ],
30
];
31