ValidationServiceProvider   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 32
ccs 9
cts 9
cp 1
rs 10
c 0
b 0
f 0
wmc 2
lcom 0
cbo 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 14 1
A register() 0 4 1
1
<?php
2
/**
3
 * ValidationServiceProvider.php
4
 *
5
 * Custom validation rules
6
 *
7
 * This program is free software: you can redistribute it and/or modify
8
 * it under the terms of the GNU General Public License as published by
9
 * the Free Software Foundation, either version 3 of the License, or
10
 * (at your option) any later version.
11
 *
12
 * This program is distributed in the hope that it will be useful,
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
15
 * GNU General Public License for more details.
16
 *
17
 * You should have received a copy of the GNU General Public License
18
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
 *
20
 * @package    LibreNMS
21
 * @link       http://librenms.org
22
 * @copyright  2016 Tony Murray
23
 * @author     Tony Murray <[email protected]>
24
 */
25
26
namespace App\Providers;
27
28
use Auth;
29
use Illuminate\Support\ServiceProvider;
30
use Validator;
31
32
class ValidationServiceProvider extends ServiceProvider
33
{
34
    /**
35
     * Bootstrap any application services.
36
     *
37
     * @return void
38
     */
39 87
    public function boot()
40
    {
41
        // match the current password for the supplied user id
42 87
        Validator::extend(
43 87
            'password',
44 87
            function ($attribute, $value, $parameters, $validator) {
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...
45
                return Auth::validate([
46
                    'user_id'  => $parameters[0],
47
                    'password' => $value,
48
                ]);
49 87
            },
50 87
            trans('passwords.current_password')
51
        );
52 87
    }
53
54
    /**
55
     * Register the service provider.
56
     *
57
     * @return void
58
     */
59 87
    public function register()
60
    {
61
        //
62 87
    }
63
}
64