DatabaseUserProviderWithPasswordUpdate   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 12
ccs 7
cts 7
cp 1
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A updatePassword() 0 5 1
A __construct() 0 3 1
1
<?php
2
3
namespace SamAsEnd\NeedsAutoRehash\Providers;
4
5
use Illuminate\Auth\DatabaseUserProvider;
6
use Illuminate\Contracts\Auth\Authenticatable;
7
8
class DatabaseUserProviderWithPasswordUpdate extends DatabaseUserProvider implements ProviderWithPasswordUpdate
9
{
10 2
    public function __construct(DatabaseUserProvider $provider)
11
    {
12 2
        parent::__construct($provider->conn, $provider->hasher, $provider->table);
13 2
    }
14
15 2
    public function updatePassword(Authenticatable $user, $plainPassword)
16
    {
17 2
        $this->conn->table($this->table)
18 2
            ->where($user->getAuthIdentifierName(), $user->getAuthIdentifier())
19 2
            ->update(['password' => $this->hasher->make($plainPassword)]);
20 2
    }
21
}
22