ElephantServiceProvider   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 5

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 6 1
A register() 0 14 1
1
<?php
2
namespace Moura137\LaravelElephant;
3
4
use ElephantIO\Client;
5
use ElephantIO\Engine\SocketIO\Version1X;
6
use Moura137\LaravelElephant\LaraElephantIO;
7
use Illuminate\Support\ServiceProvider as BaseServiceProvider;
8
9
10
class ElephantServiceProvider extends BaseServiceProvider
11
{
12
	/**
13
	 * Bootstrap the service provider.
14
	 *
15
	 * @return void
16
	 */
17
    public function boot()
18
    {
19
        $this->publishes([
20
            dirname(__DIR__) . '/config/elephant-io.php' => config_path('elephant-io.php'),
21
        ], 'config');
22
    }
23
24
    /**
25
	 * Register the service provider.
26
	 *
27
	 * @return void
28
	 */
29
	public function register()
30
    {
31
    	$this->app->singleton('elephant.io', function($app){
32
            $config = $app['config']->get('elephant-io');
33
34
            $options = array('debug' => $config['debug']);
35
36
            return new Client(new Version1X($config['url'], $options));
37
        });
38
39
        $this->app->singleton('laravel.elephantio', function($app){
40
            return new LaraElephantIO($app['elephant.io']);
41
        });
42
    }
43
}