UserRepository   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 16
rs 10
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A getUserEntityByUserCredentials() 0 11 3
1
<?php
2
3
/**
4
 * @author      Alex Bilbie <[email protected]>
5
 * @copyright   Copyright (c) Alex Bilbie
6
 * @license     http://mit-license.org/
7
 *
8
 * @link        https://github.com/thephpleague/oauth2-server
9
 */
10
11
declare(strict_types=1);
12
13
namespace OAuth2ServerExamples\Repositories;
14
15
use League\OAuth2\Server\Entities\ClientEntityInterface;
16
use League\OAuth2\Server\Entities\UserEntityInterface;
17
use League\OAuth2\Server\Repositories\UserRepositoryInterface;
18
use OAuth2ServerExamples\Entities\UserEntity;
19
20
class UserRepository implements UserRepositoryInterface
21
{
22
    /**
23
     * {@inheritdoc}
24
     */
25
    public function getUserEntityByUserCredentials(
26
        $username,
27
        $password,
28
        $grantType,
29
        ClientEntityInterface $clientEntity
30
    ): ?UserEntityInterface {
31
        if ($username === 'alex' && $password === 'whisky') {
32
            return new UserEntity();
33
        }
34
35
        return null;
36
    }
37
}
38