Completed
Pull Request — master (#9)
by
unknown
02:37
created

RedisServiceProvider::register()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1.0787

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 12
ccs 4
cts 7
cp 0.5714
crap 1.0787
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
    /**
13
     * Register the service provider.
14
     *
15
     * @return void
16
     */
17 15
    public function register()
18
    {
19
        $this->app->singleton('redis', static function ($app) {
20
            $config = $app->make('config')->get('database.redis');
21
22
            return new RedisManager($app, Arr::pull($config, 'client', 'predis'), $config);
23 15
        });
24
25
        $this->app->bind('redis.connection', static function ($app) {
26
            return $app['redis']->connection();
27 15
        });
28 15
    }
29
}
30