DatabaseServiceProvider   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Test Coverage

Coverage 0%

Importance

Changes 4
Bugs 0 Features 0
Metric Value
wmc 1
c 4
b 0
f 0
lcom 1
cbo 4
dl 0
loc 24
ccs 0
cts 8
cp 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A register() 0 16 1
1
<?php namespace Bosnadev\Database;
2
3
use Bosnadev\Database\Connectors\ConnectionFactory;
4
use Illuminate\Database\DatabaseManager;
5
6
/**
7
 * Class DatabaseServiceProvider
8
 * @package Bosnadev\Database
9
 */
10
class DatabaseServiceProvider extends \Illuminate\Database\DatabaseServiceProvider
11
{
12
    /**
13
     * Register the service provider.
14
     *
15
     * @return void
16
     */
17
    public function register()
18
    {
19
        // The connection factory is used to create the actual connection instances on
20
        // the database. We will inject the factory into the manager so that it may
21
        // make the connections while they are actually needed and not of before.
22
        $this->app->singleton('db.factory', function ($app) {
23
            return new ConnectionFactory($app);
24
        });
25
26
        // The database manager is used to resolve various connections, since multiple
27
        // connections might be managed. It also implements the connection resolver
28
        // interface which may be used by other components requiring connections.
29
        $this->app->singleton('db', function ($app) {
30
            return new DatabaseManager($app, $app['db.factory']);
31
        });
32
    }
33
}
34