Completed
Push — master ( d6d863...730950 )
by Freek
22:10 queued 19:06
created

ValidationServiceProvider   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A boot() 0 10 1
1
<?php
2
3
namespace App\Providers;
4
5
use Illuminate\Support\ServiceProvider;
6
use Validator;
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