Completed
Push — master ( efd685...083a97 )
by Mads
04:24 queued 11s
created

AuthServiceProvider::boot()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 2
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 4
ccs 0
cts 3
cp 0
crap 2
rs 10
1
<?php
2
3
namespace Napp\Core\Api\Auth;
4
5
use Illuminate\Support\Facades\Auth;
6
use Illuminate\Support\ServiceProvider;
7
8
/**
9
 * Class AuthServiceProvider.
10
 */
11
class AuthServiceProvider extends ServiceProvider
12
{
13
    /**
14
     * @return void
15
     */
16
    public function register()
17
    {
18
        Auth::extend('api', function ($app, $name, array $config) {
19
            return new ApiGuard(Auth::createUserProvider($config['provider']), $app['request'], $app['config']->get('api-core.api-key'));
0 ignored issues
show
Bug introduced by
It seems like Illuminate\Support\Facad...er($config['provider']) can also be of type null; however, parameter $provider of Napp\Core\Api\Auth\ApiGuard::__construct() does only seem to accept Illuminate\Contracts\Auth\UserProvider, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

19
            return new ApiGuard(/** @scrutinizer ignore-type */ Auth::createUserProvider($config['provider']), $app['request'], $app['config']->get('api-core.api-key'));
Loading history...
20
        });
21
    }
22
23
    public function boot()
24
    {
25
        $this->publishes([
26
            __DIR__ . '/../config/api-core.php' => config_path('api-core.php'),
27
        ]);
28
    }
29
}
30