GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

MulticoinServiceProvider   A
last analyzed

Complexity

Total Complexity 10

Size/Duplication

Total Lines 79
Duplicated Lines 0 %

Importance

Changes 5
Bugs 1 Features 0
Metric Value
eloc 23
c 5
b 1
f 0
dl 0
loc 79
rs 10
wmc 10

7 Methods

Rating   Name   Duplication   Size   Complexity  
A registerClient() 0 4 1
A registerFactory() 0 4 1
A boot() 0 4 1
A register() 0 7 1
A registerAliases() 0 10 3
A registerPublishing() 0 6 2
A registerRoutes() 0 4 1
1
<?php
2
3
namespace Multicoin\Api;
4
5
use Illuminate\Support\Facades\Route;
6
use Illuminate\Support\ServiceProvider;
7
8
class MulticoinServiceProvider extends ServiceProvider
9
{
10
    /**
11
     * Bootstrap the application services.
12
     */
13
    public function boot()
14
    {
15
        $this->registerPublishing();
16
        $this->registerRoutes();
17
    }
18
19
    /**
20
     * Register the application services.
21
     */
22
    public function register()
23
    {
24
        $this->mergeConfigFrom(__DIR__.'/../config/multicoin.php', 'multicoin');
25
26
        $this->registerAliases();
27
        $this->registerFactory();
28
        $this->registerClient();
29
    }
30
31
    /**
32
     * Register aliases.
33
     *
34
     * @return void
35
     */
36
    protected function registerAliases()
37
    {
38
        $aliases = [
39
            'multicoin' => 'Multicoin\Api\multicoinFactory',
40
            'multicoin.currency' => 'Multicoin\Api\multicoin',
41
        ];
42
43
        foreach ($aliases as $key => $aliases) {
44
            foreach ((array) $aliases as $alias) {
45
                $this->app->alias($key, $alias);
46
            }
47
        }
48
    }
49
50
    /**
51
     * Register client shortcut.
52
     *
53
     * @return void
54
     */
55
    protected function registerClient()
56
    {
57
        $this->app->bind('multicoin.currency', function ($app) {
58
            return $app['multicoin']->currency();
59
        });
60
    }
61
62
    /**
63
     * Register client factory.
64
     *
65
     * @return void
66
     */
67
    protected function registerFactory()
68
    {
69
        $this->app->singleton('multicoin', 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

69
        $this->app->singleton('multicoin', 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...
70
            return new MulticoinFactory(config('multicoin'));
71
        });
72
    }
73
74
    private function registerPublishing()
75
    {
76
        if ($this->app->runningInConsole()) {
77
            $this->publishes([
78
                __DIR__.'/../config/multicoin.php' => config_path('multicoin.php'),
79
            ], 'config');
80
        }
81
    }
82
83
    private function registerRoutes()
84
    {
85
        Route::macro('multicoinWebhook', function ($url) {
86
            return Route::any($url, '\Multicoin\Api\Http\Controllers\WebhookController');
87
        });
88
    }
89
}
90