ClientStorageMock   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 3
dl 0
loc 27
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A get() 0 13 3
A getBySession() 0 4 1
1
<?php
2
3
namespace Tests\Eole\RestApi\stubs\OAuth;
4
5
use League\OAuth2\Server\Entity\SessionEntity;
6
use League\OAuth2\Server\Entity\ClientEntity;
7
use League\OAuth2\Server\Storage\ClientInterface;
8
use League\OAuth2\Server\Storage\AbstractStorage;
9
10
class ClientStorageMock extends AbstractStorage implements ClientInterface
11
{
12
    /**
13
     * {@InheritDoc}
14
     */
15
    public function get($clientId, $clientSecret = null, $redirectUri = null, $grantType = null)
16
    {
17
        if (('client-id' === $clientId) && ('client-secret' === $clientSecret)) {
18
            $clientEntity = new ClientEntity($this->server);
19
20
            return $clientEntity->hydrate([
21
                'id' => $clientId,
22
                'secret' => $clientSecret,
23
            ]);
24
        }
25
26
        return null;
27
    }
28
29
    /**
30
     * {@InheritDoc}
31
     */
32
    public function getBySession(SessionEntity $session)
33
    {
34
        throw new \Eole\Sandstone\OAuth2\Exception\NotImplementedException();
35
    }
36
}
37