Issues (36)

config/di/ipstack.php (2 issues)

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
The variable $this seems to be never defined.
Loading history...
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 ignore-type  annotation

21
                    $ipstack->setBaseUrl(/** @scrutinizer ignore-type */ $baseUrl);
Loading history...
22
                }
23
24
                return $ipstack;
25
            }
26
        ],
27
    ],
28
];
29