Code Duplication    Length = 13-14 lines in 2 locations

config/di/db.php 1 location

@@ 10-22 (lines=13) @@
7
    "services" => [
8
        "db" => [
9
            "shared" => true,
10
            "callback" => function () {
11
                $db = new \Anax\Database\Database();
12
13
                // Load the configuration files
14
                $cfg = $this->get("configuration");
15
                $config = $cfg->load("database");
16
17
                // Set the database configuration
18
                $connection = $config["config"] ?? [];
19
                $db->setOptions($connection);
20
21
                return $db;
22
            }
23
        ],
24
    ],
25
];

config/di/dbqb.php 1 location

@@ 10-23 (lines=14) @@
7
    "services" => [
8
        "dbqb" => [
9
            "shared" => true,
10
            "callback" => function () {
11
                $db = new \Anax\DatabaseQueryBuilder\DatabaseQueryBuilder();
12
13
                // Load the configuration files
14
                $cfg = $this->get("configuration");
15
                $config = $cfg->load("database");
16
17
                // Set the database configuration
18
                $connection = $config["config"] ?? [];
19
                $db->setOptions($connection);
20
                $db->setDefaultsFromConfiguration();
21
22
                return $db;
23
            }
24
        ],
25
    ],
26
];