Passed
Branch develop (6c065e)
by Jimmy
14:36 queued 10:05
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\Nable\Ncentral\Laravel;
4
5
use Illuminate\Contracts\Foundation\Application;
6
use Illuminate\Support\ServiceProvider as LaravelServiceProvider;
7
use Spinen\Nable\Ncentral\Api\Client;
0 ignored issues
show
Bug introduced by
The type Spinen\Nable\Ncentral\Api\Client was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
8
9
/**
10
 * Class NcentralProvider
11
 *
12
 * @package Spinen\Nable\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->registerClient();
41
42
        $this->app->alias(Client::class, 'ncentral');
43
    }
44
45
    /**
46
     * Register the client object
47
     *
48
     * A Client needs to have some properties set, so in Laravel, we are going to pull them from the configs.
49
     */
50
    protected function registerClient()
51
    {
52
        $this->app->singleton(
53
            Client::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 Client();
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
            Client::class,
69
        ];
70
    }
71
}
72