Completed
Push — master ( 9628d6...a206dc )
by Derek Stephen
09:38
created

UserRepository   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
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 OAuth2\Storage\UserCredentialsInterface;
7
8
class UserRepository extends UserRepo implements UserCredentialsInterface
9
{
10
    /**
11
     * @param $email
12
     * @param $password
13
     * @return mixed
14
     */
15
    public function checkUserCredentials($email, $password)
16
    {
17
        $user = $this->findOneBy(['email' => $email]);
18
        if ($user) {
19
            return $user->verifyPassword($password);
20
        }
21
        return false;
22
    }
23
24
    /**
25
     * @param $email
26
     * @return mixed
27
     */
28
    public function getUserDetails($email)
29
    {
30
        $user = $this->findOneBy(['email' => $email]);
31
        if ($user) {
32
            $user = $user->toArray();
33
        }
34
        return $user;
35
    }
36
37
}