ClientRepository::model()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
3
4
namespace Mvdstam\Oauth2ServerLaravel\Repositories;
5
6
7
use League\OAuth2\Server\Entities\ClientEntityInterface;
8
use League\OAuth2\Server\Repositories\ClientRepositoryInterface;
9
10
class ClientRepository extends AbstractRepository implements ClientRepositoryInterface
11
{
12
13 16
    public function model()
14
    {
15 16
        return ClientEntityInterface::class;
16
    }
17
18 11
    public function getClientEntity($clientIdentifier, $grantType, $clientSecret = null, $mustValidateSecret = true)
19
    {
20 11
        $client = $this->findWhere([
21 11
            ['id', '=', $clientIdentifier]
22 11
        ] + ($mustValidateSecret ? [['secret', '=', $clientSecret]] : []));
23
24 11
        return $client ? $client->first() : null;
25
    }
26
27
}
28