SuccessfulTokenRequestAttemptResult::__construct()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 11
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 11
rs 9.4285
cc 2
eloc 7
nc 2
nop 3
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