OAuth2Controller   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 0
dl 0
loc 33
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A postAccessToken() 0 6 1
1
<?php
2
3
namespace Eole\Sandstone\OAuth2\Controller;
4
5
use Symfony\Component\HttpFoundation\Request;
6
use League\OAuth2\Server\Exception\OAuthException;
7
use League\OAuth2\Server\AuthorizationServer;
8
9
class OAuth2Controller
10
{
11
    /**
12
     * @var AuthorizationServer
13
     */
14
    private $authorizationServer;
15
16
    /**
17
     * @param AuthorizationServer $authorizationServer
18
     */
19
    public function __construct(AuthorizationServer $authorizationServer)
20
    {
21
        $this->authorizationServer = $authorizationServer;
22
    }
23
24
    /**
25
     * @param Request $request
26
     *
27
     * @return array like
28
     *      access_token:"...",
29
     *      token_type:"Bearer"
30
     *      expires_in:3600
31
     *      refresh_token:"..."
32
     *
33
     * @throws OAuthException
34
     */
35
    public function postAccessToken(Request $request)
36
    {
37
        $this->authorizationServer->setRequest($request);
0 ignored issues
show
Bug introduced by
The method setRequest() does not seem to exist on object<League\OAuth2\Server\AuthorizationServer>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
38
39
        return $this->authorizationServer->issueAccessToken();
0 ignored issues
show
Bug introduced by
The method issueAccessToken() does not seem to exist on object<League\OAuth2\Server\AuthorizationServer>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
40
    }
41
}
42