Completed
Push — master ( 52ef1a...74fab5 )
by Kunal
04:25 queued 18s
created

RabbitMQServiceProvider   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 2
dl 0
loc 34
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A register() 0 16 1
A provides() 0 4 1
1
<?php
2
3
namespace Kunnu\RabbitMQ;
4
5
use Illuminate\Support\ServiceProvider;
6
use Illuminate\Contracts\Foundation\Application;
7
8
class RabbitMQServiceProvider extends ServiceProvider
9
{
10
    /**
11
     * Register any application services.
12
     *
13
     * @return void
14
     */
15
    public function register()
16
    {
17
        // A single instance per request is enough
18
        $this->app->singleton(RabbitMQManager::class, function (Application $app) {
19
            return new RabbitMQManager($app);
20
        });
21
22
        // Create a substitute binding
23
        $this->app->bind('rabbitmq', function (Application $app) {
24
            return $app->make(RabbitMQManager::class);
25
        });
26
27
        $this->publishes([
28
            __DIR__ . '/../config/rabbitmq.php' => config_path('rabbitmq.php'),
29
        ], 'config');
30
    }
31
32
    /**
33
     * Get the services provided by the provider.
34
     *
35
     * @return array
36
     */
37
    public function provides()
38
    {
39
        return ['rabbitmq', RabbitMQManager::class];
40
    }
41
}
42