ArangoServiceProvider::register()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 18
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 9
nc 1
nop 0
dl 0
loc 18
rs 9.4285
c 0
b 0
f 0
1
<?php
2
/**
3
 * @author Donii Sergii <[email protected]>
4
 */
5
6
namespace sonrac\Arango;
7
8
use Illuminate\Database\Connection as IlluminateConnection;
9
use Illuminate\Support\ServiceProvider;
10
11
/**
12
 * Class ArangoServiceProvider.
13
 *
14
 * @author  Donii Sergii <[email protected]>
15
 */
16
class ArangoServiceProvider extends ServiceProvider
17
{
18
    /**
19
     * Register the service provider.
20
     */
21
    public function register()
22
    {
23
        // Add database driver.
24
        $this->app->singleton('arangodb.connection', function ($app) {
0 ignored issues
show
Unused Code introduced by
The parameter $app is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
25
            $config = config('database.connections.arangodb');
26
            return new Connection($config);
27
        });
28
29
        IlluminateConnection::resolverFor('arangodb', function ($config) {
0 ignored issues
show
Unused Code introduced by
The parameter $config is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
30
            return app('arangodb.connection');
31
        });
32
33
        $this->app->resolving('db', function ($db) {
34
            $db->extend('arangodb', function ($config) {
0 ignored issues
show
Unused Code introduced by
The parameter $config is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
35
                return app('arangodb.connection');
36
            });
37
        });
38
    }
39
}
40