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.
Completed
Push — master ( f9abe4...b4bcc1 )
by Sebastian
07:57
created

UrlSignerServiceProvider::setupConfig()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 6
rs 9.4286
cc 1
eloc 4
nc 1
nop 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\Http\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
     * @return void
27
     */
28
    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...
29
    {
30
        $source = realpath(__DIR__.'/../config/laravel-url-signer.php');
31
        $this->publishes([$source => config_path('laravel-url-signer.php')]);
32
        $this->mergeConfigFrom($source, 'laravel-url-signer');
33
    }
34
35
    /**
36
     * Register the service provider.
37
     *
38
     * @return void
39
     */
40
    public function register()
41
    {
42
        $this->mergeConfigFrom(__DIR__.'/../config/laravel-url-signer.php', 'laravel-url-signer');
43
44
        $config = config('laravel-url-signer');
45
46
        $config['signatureKey'] = 'mysecretkey';
47
48
        $this->app->singleton(UrlSignerContract::class, function () use ($config) {
49
            return new UrlSigner(
50
                $config['signatureKey'],
51
                $config['parameters']['expires'],
52
                $config['parameters']['signature']
53
            );
54
        });
55
56
        $this->app->alias(UrlSignerContract::class, 'url-signer');
57
58
        $this->app[Router::class]->middleware('signedurl', ValidateSignature::class);
59
    }
60
}
61