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

UserRepository   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 2
Bugs 0 Features 1
Metric Value
wmc 5
c 2
b 0
f 1
lcom 0
cbo 1
dl 0
loc 41
ccs 0
cts 24
cp 0
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getUserEntityByUserCredentials() 0 9 1
A checkUserCredentials() 0 8 2
A getUserDetails() 0 8 2
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
}