Completed
Push — develop ( c2d1c8...e852ae )
by Abdelrahman
07:46
created

LanguageServiceProvider   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A boot() 0 7 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Rinvex\Language\Providers;
6
7
use Illuminate\Support\ServiceProvider;
8
use Illuminate\Support\Facades\Validator;
9
10
class LanguageServiceProvider extends ServiceProvider
11
{
12
    /**
13
     * {@inheritdoc}
14
     */
15
    public function boot()
16
    {
17
        // Add language validation rule
18
        Validator::extend('language', function ($attribute, $value) {
19
            return array_key_exists(mb_strtolower($value), languages());
20
        }, 'Language MUST be valid!');
21
    }
22
}
23