AuthServiceProvider   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 29
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A boot() 0 8 1
1
<?php
2
3
namespace App\Providers;
4
5
use Illuminate\Support\Facades\Gate;
6
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
7
use Laravel\Passport\Passport;
8
use Illuminate\Support\Facades\Validator;
9
10
class AuthServiceProvider extends ServiceProvider
11
{
12
    /**
13
     * The policy mappings for the application.
14
     *
15
     * @var array
16
     */
17
    protected $policies=[];
18
19
    /**
20
     * The forbidden doamins that cannot register NOJ.
21
     *
22
     * @var array
23
     */
24
    protected $forbiddenDomains=['temporary.email'];
25
26
    /**
27
     * Register any authentication / authorization services.
28
     *
29
     * @return void
30
     */
31
    public function boot()
32
    {
33
        $this->registerPolicies();
34
        Passport::routes();
35
36
        Validator::extend('allowed_email_domain', function($attribute, $value, $parameters, $validator) {
0 ignored issues
show
Unused Code introduced by
The parameter $parameters is not used and could be removed. ( Ignorable by Annotation )

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

36
        Validator::extend('allowed_email_domain', function($attribute, $value, /** @scrutinizer ignore-unused */ $parameters, $validator) {

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

Loading history...
Unused Code introduced by
The parameter $validator is not used and could be removed. ( Ignorable by Annotation )

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

36
        Validator::extend('allowed_email_domain', function($attribute, $value, $parameters, /** @scrutinizer ignore-unused */ $validator) {

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

Loading history...
37
            return !in_array(explode('@', $value)[1], $this->forbiddenDomains);
38
        }, 'Domain not valid for registration.');
39
    }
40
}
41