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

Clients::validateClient()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 3
ccs 0
cts 2
cp 0
rs 10
cc 1
nc 1
nop 3
crap 2
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