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.

UrlSignerServiceProvider   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 3
dl 0
loc 44
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 4 1
A setupConfig() 0 6 1
A register() 0 18 1
1
<?php
2
3
namespace Spatie\UrlSigner\Laravel;
4
5
use Illuminate\Contracts\Foundation\Application;
6
use Illuminate\Routing\Router;
7
use Illuminate\Support\ServiceProvider;
8
use Spatie\UrlSigner\Laravel\Middleware\ValidateSignature;
9
use Spatie\UrlSigner\UrlSigner as UrlSignerContract;
10
11
class UrlSignerServiceProvider extends ServiceProvider
12
{
13
    /**
14
     * Bootstrap the application events.
15
     */
16
    public function boot()
17
    {
18
        $this->setupConfig($this->app);
19
    }
20
21
    /**
22
     * Setup the config.
23
     *
24
     * @param \Illuminate\Contracts\Foundation\Application $app
25
     */
26
    protected function setupConfig(Application $app)
0 ignored issues
show
Unused Code introduced by
The parameter $app is not used and could be removed.

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

Loading history...
27
    {
28
        $source = realpath(__DIR__.'/../config/url-signer.php');
29
        $this->publishes([$source => config_path('url-signer.php')]);
30
        $this->mergeConfigFrom($source, 'url-signer');
31
    }
32
33
    /**
34
     * Register the service provider.
35
     */
36
    public function register()
37
    {
38
        $this->mergeConfigFrom(__DIR__.'/../config/url-signer.php', 'url-signer');
39
40
        $config = config('url-signer');
41
42
        $this->app->singleton(UrlSignerContract::class, function () use ($config) {
43
            return new UrlSigner(
44
                $config['signatureKey'],
45
                $config['parameters']['expires'],
46
                $config['parameters']['signature']
47
            );
48
        });
49
50
        $this->app->alias(UrlSignerContract::class, 'url-signer');
51
52
        $this->app[Router::class]->aliasMiddleware('signedurl', ValidateSignature::class);
53
    }
54
}
55