Test Failed
Push — master ( 37356f...e6a988 )
by Adam
02:49
created

AppServiceProvider::register()   A

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
c 0
b 0
f 0
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 1
nc 1
nop 0
crap 1
1
<?php
2
3
namespace App\Providers;
4
5
use Illuminate\Support\Facades\Validator;
6
use Illuminate\Support\ServiceProvider;
7
8
class AppServiceProvider extends ServiceProvider
9
{
10
    /**
11
     * Bootstrap any application services.
12
     *
13
     * @return void
14
     */
15
    public function boot()
16
    {
17
        /*
18
         * Custom validation rules
19
         */
20 35
        Validator::extend('alpha_spaces', function ($attribute, $value) {
21
            // Accept only alpha and spaces.
22 1
            return preg_match('/^[\pL\s]+$/u', $value);
23 35
        });
24
25 35
        Validator::extend('alpha_spaces_hyphens', function ($attribute, $value) {
26
            // Accept only alpha, spaces and hyphens.
27 1
            return preg_match('/^[\pL\s-]+$/u', $value);
28 35
        });
29 35
    }
30
31
    /**
32
     * Register any application services.
33
     *
34
     * @return void
35
     */
36 35
    public function register()
37
    {
38
        //
39 35
    }
40
}
41