LaravelRatchetServiceProvider::boot()   A
last analyzed

Complexity

Conditions 3
Paths 4

Size

Total Lines 17

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 17
rs 9.7
c 0
b 0
f 0
cc 3
nc 4
nop 0
1
<?php
2
3
namespace Shamaseen\Laravel\Ratchet;
4
5
use Illuminate\Support\ServiceProvider;
6
use Shamaseen\Laravel\Ratchet\Commands\WebSocketService;
7
use Shamaseen\Laravel\Ratchet\Routes\Routes;
8
9
/**
10
 * Class GeneratorServiceProvider
11
 * @package Shamaseen\Repository\Generator
12
 */
13
class LaravelRatchetServiceProvider extends ServiceProvider
14
{
15
    /**
16
     * Bootstrap services.
17
     *
18
     * @return void
19
     */
20
    public function boot()
21
    {
22
        if ($this->app->runningInConsole()) {
23
            $this->commands([
24
                WebSocketService::class
25
            ]);
26
        }
27
28
        $this->publishes([
29
            __DIR__.'/config' => realpath('config'),
30
            __DIR__.'/Routes/published' => realpath('routes'),
31
        ],'laravel-ratchet');
32
33
        if ($this->app['config']->get('laravel-ratchet') === null) {
34
            $this->app['config']->set('laravel-ratchet', require __DIR__.'/config/laravel-ratchet.php');
35
        }
36
    }
37
38
    /**
39
     * Register services.
40
     *
41
     * @return void
42
     */
43
    public function register()
44
    {
45
        $this->app->bind('WsRoute',function (){
0 ignored issues
show
Coding Style introduced by
Expected 1 space before opening brace; found 0
Loading history...
46
            return new Routes();
47
        });
48
    }
49
}
50