Completed
Push — master ( cdc37f...ee2a0c )
by Avtandil
08:38
created

RedisServiceProvider::register()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1.0527

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 12
ccs 5
cts 8
cp 0.625
crap 1.0527
rs 9.8666
c 0
b 0
f 0
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 11
        $this->app->bind('redis.connection', function ($app) {
33
            return $app['redis']->connection();
34 11
        });
35 11
    }
36
}
37