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.

CookieConsentServiceProvider::boot()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 32

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 32
rs 9.408
c 0
b 0
f 0
1
<?php
2
3
namespace Spatie\CookieConsent;
4
5
use Cookie;
6
use Illuminate\Contracts\View\View;
7
use Illuminate\Cookie\Middleware\EncryptCookies;
8
use Illuminate\Support\ServiceProvider;
9
10
class CookieConsentServiceProvider extends ServiceProvider
11
{
12
    public function boot()
13
    {
14
        $this->publishes([
15
            __DIR__.'/../config/cookie-consent.php' => config_path('cookie-consent.php'),
16
        ], 'config');
17
18
        $this->publishes([
19
            __DIR__.'/../resources/views' => base_path('resources/views/vendor/cookieConsent'),
20
        ], 'views');
21
22
        $this->publishes([
23
            __DIR__.'/../resources/lang' => base_path('resources/lang/vendor/cookieConsent'),
24
        ], 'lang');
25
26
        $this->loadTranslationsFrom(__DIR__.'/../resources/lang', 'cookieConsent');
27
28
        $this->mergeConfigFrom(__DIR__.'/../config/cookie-consent.php', 'cookie-consent');
29
30
        $this->loadViewsFrom(__DIR__.'/../resources/views', 'cookieConsent');
31
32
        $this->app->resolving(EncryptCookies::class, function (EncryptCookies $encryptCookies) {
33
            $encryptCookies->disableFor(config('cookie-consent.cookie_name'));
34
        });
35
36
        $this->app['view']->composer('cookieConsent::index', function (View $view) {
37
            $cookieConsentConfig = config('cookie-consent');
38
39
            $alreadyConsentedWithCookies = Cookie::has($cookieConsentConfig['cookie_name']);
40
41
            $view->with(compact('alreadyConsentedWithCookies', 'cookieConsentConfig'));
42
        });
43
    }
44
}
45