ClientRepository::getClientEntity()   A
last analyzed

Complexity

Conditions 3
Paths 2

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 3

Importance

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