heidipatja /
ramverk1-weather-module
| 1 | <?php |
||||||
| 2 | /** |
||||||
| 3 | * Configuration file for Weather |
||||||
| 4 | */ |
||||||
| 5 | return [ |
||||||
| 6 | // Services to add to the container. |
||||||
| 7 | "services" => [ |
||||||
| 8 | "weather" => [ |
||||||
| 9 | "shared" => true, |
||||||
| 10 | "callback" => function () { |
||||||
| 11 | $weather = new \Hepa19\Weather\WeatherModel(); |
||||||
| 12 | $curl = new \Hepa19\Curl\Curl(); |
||||||
| 13 | $cfg = $this->get("configuration"); |
||||||
|
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
Loading history...
|
|||||||
| 14 | |||||||
| 15 | if (file_exists(ANAX_INSTALL_PATH . "/config/api_weather_config.php")) { |
||||||
| 16 | $config = $cfg->load("api_weather_config.php"); |
||||||
| 17 | $key = $config["config"]["apiKey"] ?? null; |
||||||
| 18 | $baseUrl = $config["config"]["baseUrl"] ?? null; |
||||||
| 19 | $options = $config["config"]["options"] ?? null; |
||||||
| 20 | $start = $config["config"]["start"] ?? null; |
||||||
| 21 | $stop = $config["config"]["stop"] ?? null; |
||||||
| 22 | $weather->setCurl($curl); |
||||||
| 23 | $weather->setApiKey($key); |
||||||
| 24 | $weather->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
Loading history...
|
|||||||
| 25 | $weather->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
Loading history...
|
|||||||
| 26 | $weather->setStartStop($start, $stop); |
||||||
|
0 ignored issues
–
show
It seems like
$stop can also be of type null; however, parameter $stop of Hepa19\Weather\WeatherModel::setStartStop() does only seem to accept integer, 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
Loading history...
It seems like
$start can also be of type null; however, parameter $start of Hepa19\Weather\WeatherModel::setStartStop() does only seem to accept integer, 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
Loading history...
|
|||||||
| 27 | } |
||||||
| 28 | |||||||
| 29 | return $weather; |
||||||
| 30 | } |
||||||
| 31 | ], |
||||||
| 32 | ], |
||||||
| 33 | ]; |
||||||
| 34 |