1 | <?php |
||||
2 | /** |
||||
3 | * Configuration file for IPStack |
||||
4 | */ |
||||
5 | return [ |
||||
6 | // Services to add to the container. |
||||
7 | "services" => [ |
||||
8 | "ipstack" => [ |
||||
9 | "shared" => true, |
||||
10 | "callback" => function () { |
||||
11 | $ipstack = new \Hepa19\IPGeo\IPStack(); |
||||
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_ip_config.php")) { |
||||
16 | $config = $cfg->load("api_ip_config.php"); |
||||
17 | $key = $config["config"]["apiKey"] ?? null; |
||||
18 | $baseUrl = $config["config"]["baseUrl"] ?? null; |
||||
19 | $ipstack->setCurl($curl); |
||||
20 | $ipstack->setApiKey($key); |
||||
21 | $ipstack->setBaseUrl($baseUrl); |
||||
0 ignored issues
–
show
It seems like
$baseUrl can also be of type null ; however, parameter $baseUrl of Hepa19\IPGeo\IPStack::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
![]() |
|||||
22 | } |
||||
23 | |||||
24 | return $ipstack; |
||||
25 | } |
||||
26 | ], |
||||
27 | ], |
||||
28 | ]; |
||||
29 |