RedisSentinelServiceProvider   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
c 1
b 0
f 0
lcom 1
cbo 4
dl 0
loc 39
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 4 1
A register() 0 6 1
A registerRedisSentinelConnector() 0 6 1
A provides() 0 4 1
1
<?php
2
3
namespace RedisSentinel\Laravel;
4
5
use Illuminate\Queue\QueueManager;
6
use Illuminate\Support\ServiceProvider;
7
8
class RedisSentinelServiceProvider extends ServiceProvider
9
{
10
    /**
11
     * Add the connector to the queue drivers
12
     */
13
    public function boot()
14
    {
15
        $this->registerRedisSentinelConnector($this->app['queue']);
16
    }
17
18
    /**
19
     * Register the service provider.
20
     *
21
     * @return void
22
     */
23
    public function register()
24
    {
25
        $this->app->singleton('redis', function($app) {
26
            return new Database($app['config']['database.redis']);
27
        });
28
    }
29
30
    protected function registerRedisSentinelConnector(QueueManager $manager)
31
    {
32
        $manager->addConnector('sentinel-redis', function() {
33
            return new SentinelConnector($this->app['redis']);
34
        });
35
    }
36
37
    /**
38
     * Get the services provided by the provider.
39
     *
40
     * @return array
41
     */
42
    public function provides()
43
    {
44
        return ['redis'];
45
    }
46
}
47