Completed
Push — master ( 9d421d...7b686b )
by Avtandil
10:28 queued 08:22
created

RedisServiceProvider   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 57.14%

Importance

Changes 0
Metric Value
dl 0
loc 20
ccs 4
cts 7
cp 0.5714
rs 10
c 0
b 0
f 0
wmc 1
lcom 1
cbo 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A register() 0 12 1
1
<?php
2
/*
3
 * This file is part of the Laravel Lodash package.
4
 *
5
 * (c) Avtandil Kikabidze aka LONGMAN <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
declare(strict_types=1);
11
12
namespace Longman\LaravelLodash\Redis;
13
14
use Illuminate\Redis\RedisServiceProvider as BaseRedisServiceProvider;
15
use Illuminate\Support\Arr;
16
17
class RedisServiceProvider extends BaseRedisServiceProvider
18
{
19
    /**
20
     * Register the service provider.
21
     *
22
     * @return void
23
     */
24 11
    public function register()
25
    {
26
        $this->app->singleton('redis', function ($app) {
27
            $config = $app->make('config')->get('database.redis');
28
29
            return new RedisManager($app, Arr::pull($config, 'client', 'predis'), $config);
30 11
        });
31
32
        $this->app->bind('redis.connection', function ($app) {
33
            return $app['redis']->connection();
34 11
        });
35 11
    }
36
}
37