Database::__construct()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
dl 0
loc 8
ccs 0
cts 5
cp 0
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 1
crap 6
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