Completed
Push — master ( 0d8f27...c602d8 )
by Tyler
03:09
created

ServiceProvider   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 85%

Importance

Changes 0
Metric Value
wmc 7
lcom 1
cbo 3
dl 0
loc 42
ccs 17
cts 20
cp 0.85
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 4 1
B register() 0 24 6
1
<?php 
2
3
namespace Tylercd100\Validator\Phone;
4
5
use Illuminate\Support\ServiceProvider as IlluminateProvider;
6
use Tylercd100\Validator\Phone\Validator;
7
8
class ServiceProvider extends IlluminateProvider
9
{
10
    /**
11
     * Bootstrap the application events.
12
     *
13
     * @return void
14
     */
15 18
    public function boot()
16
    {
17
18 18
    }
19
20
    /**
21
     * Register the service provider.
22
     *
23
     * @return void
24
     */
25 18
    public function register()
26
    {
27
        $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...
28
            
29 15
            $x = new Validator();
30
31 15
            $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...
32 15
                if (count($parameters) > 0) {
33 9
                    switch ($parameters[0]) {
34 9
                        case 'e164':
35 9
                        case 'E164':
36 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...
37 3
                        case 'nanp':
38 3
                        case 'NANP':
39 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...
40
                        default:
41
                            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...
42
                    }
43
                } else {
44 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...
45
                }
46 15
            }, "Not a valid phone number");
47 18
        });
48 18
    }
49
}
50