Completed
Push — master ( a3ab04...96da42 )
by Maxime
03:50
created

MessengerLumenServiceProvider::boot()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 6
ccs 0
cts 6
cp 0
rs 9.4285
cc 1
eloc 4
nc 1
nop 0
crap 2
1
<?php namespace Distilleries\Messenger;
2
3
use Distilleries\Messenger\Helpers\Message;
4
use GuzzleHttp\Client;
5
use Illuminate\Support\ServiceProvider;
6
use Illuminate\Foundation\AliasLoader;
7
use Illuminate\Routing\Router;
8
9
class MessengerLumenServiceProvider extends ServiceProvider {
10
11
12
    protected $package = 'messenger';
13
    protected $namespace = 'Distilleries\Messenger\Http\Controllers';
14
15
16
    public function boot()
17
    {
18
        $this->loadViewsFrom(__DIR__.'/../../views', $this->package);
19
        $this->loadTranslationsFrom(__DIR__.'/../../lang', $this->package);
20
        $this->map();
21
    }
22
23
    /**
24
     * Register the service provider.
25
     *
26
     * @return void
27
     */
28 View Code Duplication
    public function register()
1 ignored issue
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
29
    {
30
        $this->mergeConfigFrom(
31
            __DIR__.'/../../config/config.php',
32
            $this->package
33
        );
34
35
36
        $this->app['messenger'] = $this->app->share(function($app)
37
        {
38
            return new Message($app['config']->get('messenger'),new Client());
39
        });
40
41
        $this->alias();
42
    }
43
44
    /**
45
     * Get the services provided by the provider.
46
     *
47
     * @return string[]
48
     */
49
    public function provides()
50
    {
51
        return array('messenger');
52
    }
53
54
55
    public function alias() {
56
57
        $this->app->alias('Route','Illuminate\Support\Facades\Route');
58
        $this->app->alias('Log','Illuminate\Support\Facades\Log');
59
60
    }
61
62
    /**
63
     * Define the routes for the application.
64
     *
65
     * @param  \Illuminate\Routing\Router  $router
0 ignored issues
show
Bug introduced by
There is no parameter named $router. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
66
     * @return void
67
     */
68
    public function map()
69
    {
70
        $this->app->group(['namespace' => $this->namespace], function($app)
1 ignored issue
show
Bug introduced by
The method group() does not seem to exist on object<Illuminate\Contra...Foundation\Application>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
71
        {
72
            require __DIR__ . '/Http/routes_lumen.php';
73
        });
74
    }
75
}