Database   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 1
dl 0
loc 36
ccs 0
cts 13
cp 0
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A instance() 0 8 2
A __construct() 0 8 2
A run() 0 8 1
1
<?php
2
3
namespace CodexShaper\Database;
4
5
use Illuminate\Database\Capsule\Manager as CapsulManager;
6
7
class Database extends CapsulManager
8
{
9
    /**
10
     * Inherited.
11
     *
12
     * @var object
13
     */
14
    protected static $instance = false;
15
16
    public static function instance()
17
    {
18
        if (!static::$instance) {
19
            static::$instance = new self();
20
        }
21
22
        return static::$instance;
23
    }
24
25
    public function __construct($options = [])
26
    {
27
        parent::__construct();
28
29
        if (!empty($options)) {
30
            $this->addConnection($options);
31
        }
32
    }
33
34
    public function run()
35
    {
36
        //Make this Database instance available globally.
37
        $this->setAsGlobal();
38
39
        // Setup the Eloquent ORM.
40
        $this->bootEloquent();
41
    }
42
}
43