Total Complexity | 7 |
Total Lines | 41 |
Duplicated Lines | 0 % |
Coverage | 0% |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
19 | class Clients extends \Nip\Records\RecordManager implements ClientRepositoryInterface |
||
20 | { |
||
21 | use SingletonTrait; |
||
22 | |||
23 | /** |
||
24 | * {@inheritdoc} |
||
25 | */ |
||
26 | public function getClientEntity( |
||
27 | $clientIdentifier, |
||
28 | $grantType = null, |
||
29 | $clientSecret = null, |
||
30 | $mustValidateSecret = true |
||
31 | ) { |
||
32 | // First, we will verify that the client exists |
||
33 | $client = $this->findOneByIdentifier($clientIdentifier); |
||
34 | |||
35 | if (!$client || !$client->handlesGrant($grantType)) { |
||
|
|||
36 | return; |
||
37 | } |
||
38 | |||
39 | if ($mustValidateSecret && !$client->validateSecret($clientSecret)) { |
||
40 | return; |
||
41 | } |
||
42 | return $client; |
||
43 | } |
||
44 | |||
45 | /** @noinspection PhpMissingParentCallCommonInspection |
||
46 | * @inheritDoc |
||
47 | */ |
||
48 | protected function generateTable() |
||
51 | } |
||
52 | |||
53 | /** |
||
54 | * @inheritDoc |
||
55 | * @TODO add some validation logic |
||
56 | */ |
||
57 | public function validateClient($clientIdentifier, $clientSecret, $grantType) |
||
62 |