Passed
Push — master ( 056d39...c33903 )
by Gabriel
04:13
created

Clients   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Test Coverage

Coverage 12.5%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 3
eloc 6
c 1
b 0
f 1
dl 0
loc 36
ccs 1
cts 8
cp 0.125
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A validateClient() 0 3 1
A generateTable() 0 3 1
A getClientEntity() 0 12 1
1
<?php
2
3
namespace ByTIC\Hello\Models\Clients;
4
5
use League\OAuth2\Server\Repositories\ClientRepositoryInterface;
6
use Nip\Records\Collections\Collection;
7
use Nip\Utility\Traits\SingletonTrait;
8
9
/**
10
 * Class Tokens
11
 * @package ByTIC\Hello\Models\Clients
12
 *
13
 * @method Client getNew()
14
 * @method Client findOneByIdentifier(string $clientIdentifier)
15
 * @method Client findOne(string $clientIdentifier)
16
 *
17
 * @method Client[]|Collection findByRedirect(string $uri)
18
 */
19
class Clients extends \Nip\Records\RecordManager implements ClientRepositoryInterface
20
{
21 1
    use SingletonTrait;
22
23
    /**
24
     * {@inheritdoc}
25
     */
26
    public function getClientEntity($clientIdentifier)
27
    {
28
        $client = $this->findOneByIdentifier($clientIdentifier);
29
30
//        if (!$client || !$client->handlesGrant($grantType)) {
31
//            return;
32
//        }
33
//
34
//        if ($mustValidateSecret && !$client->validateSecret($clientSecret)) {
35
//            return;
36
//        }
37
        return $client;
38
    }
39
40
    /** @noinspection PhpMissingParentCallCommonInspection
41
     * @inheritDoc
42
     */
43
    protected function generateTable()
44
    {
45
        return 'oauth_clients';
46
    }
47
48
    /**
49
     * @inheritDoc
50
     * @TODO add some validation logic
51
     */
52
    public function validateClient($clientIdentifier, $clientSecret, $grantType)
53
    {
54
        return true;
55
    }
56
}
57