RedisServiceProvider::register()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 12

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1.037

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 12
ccs 6
cts 9
cp 0.6667
crap 1.037
rs 9.8666
c 0
b 0
f 0
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 71
    public function register(): void
13
    {
14 71
        $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 71
        });
19
20 71
        $this->app->bind('redis.connection', static function ($app) {
21
            return $app['redis']->connection();
22 71
        });
23 71
    }
24
}
25