SuccessfulTokenRequestAttemptResult   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 11 2
A getGrantDecision() 0 4 1
A getAccessToken() 0 4 1
A getRefreshToken() 0 4 1
1
<?php
2
/**
3
 * @author Boris Guéry <[email protected]>
4
 */
5
6
namespace Bgy\OAuth2;
7
8
use Bgy\OAuth2\GrantType\GrantDecision;
9
10
class SuccessfulTokenRequestAttemptResult implements TokenRequestAttemptResult
11
{
12
    private $grantDecision;
13
    private $accessToken;
14
    private $refreshToken;
15
16
    public function __construct(GrantDecision $grantDecision, AccessToken $accessToken,
17
                                RefreshToken $refreshToken = null)
18
    {
19
        if ($grantDecision->isDenied()) {
20
            throw new \LogicException('Could not construct SuccessfulTokenRequestResult with a denied GrantDecision');
21
        }
22
23
        $this->grantDecision = $grantDecision;
24
        $this->accessToken   = $accessToken;
25
        $this->refreshToken  = $refreshToken;
26
    }
27
28
    public function getGrantDecision()
29
    {
30
        return $this->grantDecision;
31
    }
32
33
    public function getAccessToken()
34
    {
35
        return $this->accessToken;
36
    }
37
38
    public function getRefreshToken()
39
    {
40
        return $this->refreshToken;
41
    }
42
}
43