Completed
Push — master ( 2a258c...683c35 )
by Alexandre
02:27
created

AuthenticatedRequest::getAccessToken()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: Alexandre
5
 * Date: 27/05/2018
6
 * Time: 17:48
7
 */
8
9
namespace OAuth2\Roles\ResourceServer;
10
11
12
use OAuth2\Credentials\AccessTokenInterface;
13
use OAuth2\Roles\ClientTypes\RegisteredClientInterface;
14
use OAuth2\Roles\ResourceOwnerInterface;
15
use Psr\Http\Message\ServerRequestInterface;
16
17
class AuthenticatedRequest
18
{
19
    /**
20
     * @var ServerRequestInterface
21
     */
22
    private $request;
23
    /**
24
     * @var RegisteredClientInterface
25
     */
26
    private $client;
27
    /**
28
     * @var null|ResourceOwnerInterface
29
     */
30
    private $resourceOwner;
31
    /**
32
     * @var AccessTokenInterface
33
     */
34
    private $accessToken;
35
36
    public function __construct(ServerRequestInterface $request,
37
                                RegisteredClientInterface $client,
38
                                ?ResourceOwnerInterface $resourceOwner,
39
                                AccessTokenInterface $accessToken)
40
    {
41
        $this->request = $request;
42
        $this->client = $client;
43
        $this->resourceOwner = $resourceOwner;
44
        $this->accessToken = $accessToken;
45
    }
46
47
    /**
48
     * @return ServerRequestInterface
49
     */
50
    public function getRequest(): ServerRequestInterface
51
    {
52
        return $this->request;
53
    }
54
55
    /**
56
     * @return RegisteredClientInterface
57
     */
58
    public function getClient(): RegisteredClientInterface
59
    {
60
        return $this->client;
61
    }
62
63
    /**
64
     * @return null|ResourceOwnerInterface
65
     */
66
    public function getResourceOwner(): ?ResourceOwnerInterface
67
    {
68
        return $this->resourceOwner;
69
    }
70
71
    /**
72
     * @return array
73
     */
74
    public function getScopes(): array
75
    {
76
        return $this->accessToken->getScopes();
77
    }
78
79
    /**
80
     * @return AccessTokenInterface
81
     */
82
    public function getAccessToken(): AccessTokenInterface
83
    {
84
        return $this->accessToken;
85
    }
86
}