ElephantServiceProvider::boot()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 0
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
}