LaravelRatchetServiceProvider   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 3
dl 0
loc 37
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 17 3
A register() 0 6 1
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