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
![]() |
|||||
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
![]() |
|||||
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
![]() |
|||||
24 | } |
||||
25 | |||||
26 | return $weatherProg; |
||||
27 | } |
||||
28 | ], |
||||
29 | ], |
||||
30 | ]; |
||||
31 |