Passed
Push — master ( 38f4a6...40dda5 )
by Toby
02:50
created

UnionCloudServiceProvider   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 4 1
A register() 0 13 1
1
<?php
2
/**
3
 * Service provider for UnionCloud
4
 */
5
6
namespace Twigger\UnionCloud\API;
7
8
use Illuminate\Support\ServiceProvider;
9
10
11
/**
12
 * Allow Laravel to use UnionCloud
13
 * Class UnionCloudServiceProvider
14
 *
15
 * @package Twigger\UnionCloud\API
16
 */
17
class UnionCloudServiceProvider extends ServiceProvider
18
{
19
20
    /**
21
     * Indicates if loading of the provider is deferred.
22
     *
23
     * @var bool
24
     */
25
    protected $defer = true;
26
27
    /**
28
     * Bootstrap the application events.
29
     *
30
     * @return void
31
     */
32
    public function boot()
33
    {
34
        $this->publishes([
35
            __DIR__ . '/../laravel/resources/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

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

48
        $this->app->singleton('handleuc', 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...
49
            return new UnionCloud();
50
            $unionCloud = new UnionCloud([
0 ignored issues
show
Unused Code introduced by
$unionCloud = new Twigge...auth']['appPassword'])) is not reachable.

This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.

Unreachable code is most often the result of return, die or exit statements that have been added for debug purposes.

function fx() {
    try {
        doSomething();
        return true;
    }
    catch (\Exception $e) {
        return false;
    }

    return false;
}

In the above example, the last return false will never be executed, because a return statement has already been met in every possible execution path.

Loading history...
51
                'email' => $app->config['unioncloud']['v0auth']['email'],
52
                'password' => $app->config['unioncloud']['v0auth']['password'],
53
                'appID' => $app->config['unioncloud']['v0auth']['appID'],
54
                'appPassword' => $app->config['unioncloud']['v0auth']['appPassword'],
55
            ]);
56
            $unionCloud->setBaseURL($app->config['unioncloud']['baseURL']);
57
            return $unionCloud;
58
        });
59
    }
60
61
}