Issues (35)

config/di/ipstackcfg.php (1 issue)

1
<?php
2
/**
3
 * Configuration file for DI container.
4
 */
5
return [
6
7
    // Services to add to the container.
8
    "services" => [
9
        "ipstackcfg" => [
10
            // Is the service shared, true or false
11
            // Optional, default is true
12
            "shared" => true,
13
14
            // Is the service activated by default, true or false
15
            // Optional, default is false
16
            "active" => true,
17
18
            // Callback executed when service is activated
19
            // Create the service, load its configuration (if any)
20
            // and set it up.
21
            "callback" => function () {
22
                $geoLocationByIpModel = new \Bashar\GeoLocationModel\GeoLocationByIpModel();
23
24
                // Load the configuration files
25
                $cfg = $this->get("configuration");
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $this seems to be never defined.
Loading history...
26
                $config = $cfg->load("geoToken.php");
27
                $settings = $config["config"] ?? null;
28
29
                if ($settings["message"] ?? null) {
30
                    $geoLocationByIpModel->setMessage($settings["message"]);
31
                }
32
33
                return $geoLocationByIpModel;
34
            }
35
        ],
36
    ],
37
];
38