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 ( 61966d...b687e8 )
by Freek
12s
created

CorsServiceProvider::isLaravel()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace Spatie\Cors;
4
5
use Illuminate\Support\ServiceProvider;
6
use Spatie\Cors\CorsProfile\CorsProfile;
7
use Spatie\Cors\CorsProfile\DefaultProfile;
8
use Spatie\Cors\Exceptions\InvalidCorsProfile;
9
10
class CorsServiceProvider extends ServiceProvider
11
{
12
    public function boot()
13
    {
14
        if ($this->isLaravel() && $this->app->runningInConsole()) {
15
            $this->publishes([
16
                __DIR__ . '/../config/cors.php' => config_path('cors.php'),
17
            ], 'config');
18
        }
19
20
        $configuredCorsProfile = config('cors.cors_profile');
21
22
        if (! is_a($configuredCorsProfile, DefaultProfile::class, true)) {
23
            throw InvalidCorsProfile::profileDoesNotExtendDefaultProfile($configuredCorsProfile);
24
        }
25
26
        $this->app->bind(CorsProfile::class, $configuredCorsProfile);
27
    }
28
29
    public function register()
30
    {
31
        if ($this->isLaravel()) {
32
            $this->mergeConfigFrom(__DIR__ . '/../config/cors.php', 'cors');
33
        }
34
    }
35
36
    protected function isLaravel()
37
    {
38
        return ! preg_match('/lumen/i', app()->version());
39
    }
40
}
41