ValidationServiceProvider   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 13
rs 10
c 0
b 0
f 0
wmc 1
lcom 0
cbo 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A boot() 0 10 1
1
<?php
2
3
namespace App\Providers;
4
5
use Validator;
6
use Illuminate\Support\ServiceProvider;
7
8
class ValidationServiceProvider extends ServiceProvider
9
{
10
    public function boot()
11
    {
12
        Validator::extend('enum', function ($attribute, $value, $parameters) {
13
14
            /** @var \App\Foundation\Enums\Enum $class */
15
            $class = $parameters[0];
16
17
            return $class::isValid($value);
18
        });
19
    }
20
}
21