Completed
Push — master ( 24ab37...36f73c )
by Derek Stephen
01:35
created

UserRepository::checkUserCredentials()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
dl 0
loc 8
ccs 0
cts 8
cp 0
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 5
nc 2
nop 2
crap 6
1
<?php
2
3
namespace OAuth\Repository;
4
5
use Del\Repository\UserRepository as UserRepo;
6
use League\OAuth2\Server\Entities\ClientEntityInterface;
7
use League\OAuth2\Server\Entities\UserEntityInterface;
8
use League\OAuth2\Server\Repositories\UserRepositoryInterface;
9
10
class UserRepository extends UserRepo implements UserRepositoryInterface
11
{
12
    public function getUserEntityByUserCredentials(
13
        $email,
14
        $password,
15
        $grantType,
16
        ClientEntityInterface $client
17
    )
18
    {
19
        // TODO: Implement getUserEntityByUserCredentials() method.
20
    }
21
22
23
    /**
24
     * @param $email
25
     * @param $password
26
     * @return mixed
27
     */
28
    public function checkUserCredentials($email, $password)
29
    {
30
        $user = $this->findOneBy(['email' => $email]);
31
        if ($user) {
32
            return $user->verifyPassword($password);
33
        }
34
        return false;
35
    }
36
37
    /**
38
     * @param $email
39
     * @return mixed
40
     */
41
    public function getUserDetails($email)
42
    {
43
        $user = $this->findOneBy(['email' => $email]);
44
        if ($user) {
45
            $user = $user->toArray();
46
        }
47
        return $user;
48
    }
49
50
}