Passed
Push — master ( 521044...17cc72 )
by Toby
03:58
created

UnionCloudServiceProvider   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 13
dl 0
loc 40
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A register() 0 12 1
A boot() 0 5 1
1
<?php
2
/**
3
 * Service provider for UnionCloud
4
 */
5
6
namespace Twigger\UnionCloud\API\Laravel;
7
8
use Illuminate\Support\ServiceProvider;
9
use Twigger\UnionCloud\API\UnionCloud;
10
11
12
/**
13
 * Allow Laravel to use UnionCloud
14
 * Class UnionCloudServiceProvider
15
 *
16
 * @package Twigger\UnionCloud\API
17
 */
18
class UnionCloudServiceProvider extends ServiceProvider
19
{
20
21
    /**
22
     * Indicates if loading of the provider is deferred.
23
     *
24
     * @var bool
25
     */
26
    protected $defer = true;
27
28
    /**
29
     * Bootstrap the application events.
30
     *
31
     * @return void
32
     */
33
    public function boot()
34
    {
35
        $this->publishes([
36
            __DIR__ . '/config/unioncloud.php' => config_path('unioncloud.php'),
0 ignored issues
show
Bug introduced by
The function config_path was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

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

36
            __DIR__ . '/config/unioncloud.php' => /** @scrutinizer ignore-call */ config_path('unioncloud.php'),
Loading history...
37
        ], 'config');
38
39
    }
40
41
    /**
42
     * Register the service provider.
43
     *
44
     * @return void
45
     */
46
    public function register()
47
    {
48
49
        $this->app->singleton('Twigger\UnionCloud\API\UnionCloud', function($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

49
        $this->app->singleton('Twigger\UnionCloud\API\UnionCloud', function(/** @scrutinizer ignore-unused */ $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...
50
            $unionCloud = new UnionCloud([
51
                'email' => config('unioncloud.v0auth.email', 'email'),
0 ignored issues
show
Bug introduced by
The function config was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

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

51
                'email' => /** @scrutinizer ignore-call */ config('unioncloud.v0auth.email', 'email'),
Loading history...
52
                'password' => config('unioncloud.v0auth.password', 'password'),
53
                'appID' => config('unioncloud.v0auth.appID', 'appID'),
54
                'appPassword' => config('unioncloud.v0auth.appPassword', 'appPassword'),
55
            ]);
56
            $unionCloud->setBaseURL(config('unioncloud.baseURL', 'union.unioncloud.org'));
57
            return $unionCloud;
58
        });
59
    }
60
61
}