ServiceProvider::boot()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 1
nc 1
nop 0
crap 1
1
<?php 
2
3
namespace Tylercd100\Validator\Phone;
4
5
use Exception;
6
use Illuminate\Support\ServiceProvider as IlluminateProvider;
7
use Tylercd100\Validator\Phone\Validator;
8
9
class ServiceProvider extends IlluminateProvider
10
{
11
    /**
12
     * Bootstrap the application events.
13
     *
14
     * @return void
15
     */
16 24
    public function boot()
17
    {
18
19 24
    }
20
21
    /**
22
     * Register the service provider.
23
     *
24
     * @return void
25
     */
26 24
    public function register()
27
    {
28
        $this->app->resolving('validator', function ($factory, $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 21
            $x = new Validator();
31
32 21
            $factory->extend('phone', function ($attribute, $value, $parameters, $validator) use ($x) {
0 ignored issues
show
Unused Code introduced by
The parameter $validator 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...
33 21
                if (count($parameters) > 0) {
34 15
                    switch ($parameters[0]) {
35 15
                        case 'digits':
36 3
                            return $x->isDigits($value);
0 ignored issues
show
Bug introduced by
The method isDigits() cannot be called from this context as it is declared protected in class Tylercd100\Validator\Phone\Validator.

This check looks for access to methods that are not accessible from the current context.

If you need to make a method accessible to another context you can raise its visibility level in the defining class.

Loading history...
37 12
                        case 'e164':
38 12
                        case 'E164':
39 6
                            return $x->isE164($value);
0 ignored issues
show
Bug introduced by
The method isE164() cannot be called from this context as it is declared protected in class Tylercd100\Validator\Phone\Validator.

This check looks for access to methods that are not accessible from the current context.

If you need to make a method accessible to another context you can raise its visibility level in the defining class.

Loading history...
40 6
                        case 'nanp':
41 6
                        case 'NANP':
42 3
                            return $x->isNANP($value);
0 ignored issues
show
Bug introduced by
The method isNANP() cannot be called from this context as it is declared protected in class Tylercd100\Validator\Phone\Validator.

This check looks for access to methods that are not accessible from the current context.

If you need to make a method accessible to another context you can raise its visibility level in the defining class.

Loading history...
43 3
                        default:
44 3
                            throw new Exception($parameters[0]." is not a supported phone validation type.", 1);
45 3
                    }
46
                } else {
47 6
                    return $x->isPhone($value);
0 ignored issues
show
Bug introduced by
The method isPhone() cannot be called from this context as it is declared protected in class Tylercd100\Validator\Phone\Validator.

This check looks for access to methods that are not accessible from the current context.

If you need to make a method accessible to another context you can raise its visibility level in the defining class.

Loading history...
48
                }
49 21
            }, "Not a valid phone number");
50 24
        });
51 24
    }
52
}
53