Completed
Push — master ( efafaa...1ce8a3 )
by Avtandil
05:26
created

RedisServiceProvider   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Test Coverage

Coverage 66.67%

Importance

Changes 0
Metric Value
dl 0
loc 15
ccs 6
cts 9
cp 0.6667
rs 10
c 0
b 0
f 0
wmc 1
lcom 1
cbo 4

1 Method

Rating   Name   Duplication   Size   Complexity  
A register() 0 12 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Longman\LaravelLodash\Redis;
6
7
use Illuminate\Redis\RedisServiceProvider as BaseRedisServiceProvider;
8
use Illuminate\Support\Arr;
9
10
class RedisServiceProvider extends BaseRedisServiceProvider
11
{
12 14
    public function register(): void
13
    {
14 14
        $this->app->singleton('redis', static function ($app) {
15
            $config = $app->make('config')->get('database.redis');
16
17
            return new RedisManager($app, Arr::pull($config, 'client', 'phpredis'), $config);
18 14
        });
19
20 14
        $this->app->bind('redis.connection', static function ($app) {
21
            return $app['redis']->connection();
22 14
        });
23 14
    }
24
}
25