Test Failed
Pull Request — develop (#4)
by Stephen
06:10
created

ServiceProvider::boot()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 0
nc 1
nop 0
dl 0
loc 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Spinen\Ncentral\Laravel;
4
5
use Illuminate\Contracts\Foundation\Application;
6
use Illuminate\Support\ServiceProvider as LaravelServiceProvider;
7
use Spinen\Ncentral\NcentralClient;
8
9
/**
10
 * Class NcentralProvider
11
 *
12
 * @package Spinen\Ncentral\Laravel
13
 */
14
class ServiceProvider extends LaravelServiceProvider
15
{
16
    /**
17
     * Indicates if loading of the provider is deferred.
18
     *
19
     * @var bool
20
     */
21
    protected $defer = true;
22
23
    /**
24
     * Bootstrap the application services.
25
     *
26
     * @return void
27
     */
28
    public function boot()
29
    {
30
        //
31
    }
32
33
    /**
34
     * Register the application services.
35
     *
36
     * @return void
37
     */
38
    public function register()
39
    {
40
        $this->registerNcentralClient();
41
42
        $this->app->alias(NcentralClient::class, 'ncentral');
43
    }
44
45
    /**
46
     * Register the NcentralClient object
47
     *
48
     * A NcentralClient needs to have some properties set, so in Laravel, we are going to pull them from the configs.
49
     */
50
    protected function registerNcentralClient()
51
    {
52
        $this->app->singleton(
53
            NcentralClient::class,
54
            function (Application $app) {
0 ignored issues
show
Unused Code introduced by
The parameter $app is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

54
            function (/** @scrutinizer ignore-unused */ Application $app) {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
55
                return new NcentralClient();
56
            }
57
        );
58
    }
59
60
    /**
61
     * Get the services provided by the provider.
62
     *
63
     * @return array
64
     */
65
    public function provides()
66
    {
67
        return [
68
            NcentralClient::class,
69
        ];
70
    }
71
}
72