Completed
Push — master ( d0c6f2...e28c79 )
by Avtandil
03:11
created

RedisServiceProvider::register()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 6
nc 1
nop 0
dl 0
loc 12
ccs 0
cts 10
cp 0
crap 2
rs 9.4285
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
    public function register()
25
    {
26
        $this->app->singleton('redis', function ($app) {
27
            $config = $app->make('config')->get('database.redis');
28
29
            return new RedisManager(Arr::pull($config, 'client', 'predis'), $config);
30
        });
31
32
        $this->app->bind('redis.connection', function ($app) {
33
            return $app['redis']->connection();
34
        });
35
    }
36
}
37