1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
/* |
6
|
|
|
* The MIT License (MIT) |
7
|
|
|
* |
8
|
|
|
* Copyright (c) 2014-2018 Spomky-Labs |
9
|
|
|
* |
10
|
|
|
* This software may be modified and distributed under the terms |
11
|
|
|
* of the MIT license. See the LICENSE file for details. |
12
|
|
|
*/ |
13
|
|
|
|
14
|
|
|
namespace OAuth2Framework\Component\Core\AccessToken\Command; |
15
|
|
|
|
16
|
|
|
use OAuth2Framework\Component\Core\AccessToken\AccessTokenId; |
17
|
|
|
use OAuth2Framework\Component\Core\Client\ClientId; |
18
|
|
|
use OAuth2Framework\Component\Core\DataBag\DataBag; |
19
|
|
|
use OAuth2Framework\Component\Core\ResourceOwner\ResourceOwnerId; |
20
|
|
|
use OAuth2Framework\Component\Core\ResourceServer\ResourceServerId; |
21
|
|
|
|
22
|
|
|
class CreateAccessToken |
23
|
|
|
{ |
24
|
|
|
private $accessTokenId; |
25
|
|
|
private $resourceOwnerId; |
26
|
|
|
private $clientId; |
27
|
|
|
private $parameter; |
28
|
|
|
private $metadata; |
29
|
|
|
private $expiresAt; |
30
|
|
|
private $resourceServerId; |
31
|
|
|
|
32
|
|
|
public function __construct(AccessTokenId $accessTokenId, ResourceOwnerId $resourceOwnerId, ClientId $clientId, DataBag $parameter, DataBag $metadata, \DateTimeImmutable $expiresAt, ?ResourceServerId $resourceServerId) |
33
|
|
|
{ |
34
|
|
|
$this->accessTokenId = $accessTokenId; |
35
|
|
|
$this->resourceOwnerId = $resourceOwnerId; |
36
|
|
|
$this->clientId = $clientId; |
37
|
|
|
$this->parameter = $parameter; |
38
|
|
|
$this->metadata = $metadata; |
39
|
|
|
$this->expiresAt = $expiresAt; |
40
|
|
|
$this->resourceServerId = $resourceServerId; |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
public function getAccessTokenId(): AccessTokenId |
44
|
|
|
{ |
45
|
|
|
return $this->accessTokenId; |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
public function getResourceOwnerId(): ResourceOwnerId |
49
|
|
|
{ |
50
|
|
|
return $this->resourceOwnerId; |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
public function getClientId(): ClientId |
54
|
|
|
{ |
55
|
|
|
return $this->clientId; |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
public function getParameter(): DataBag |
59
|
|
|
{ |
60
|
|
|
return $this->parameter; |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
public function getMetadata(): DataBag |
64
|
|
|
{ |
65
|
|
|
return $this->metadata; |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
public function getExpiresAt(): \DateTimeImmutable |
69
|
|
|
{ |
70
|
|
|
return $this->expiresAt; |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
public function getResourceServerId(): ?ResourceServerId |
|
|
|
|
74
|
|
|
{ |
75
|
|
|
return $this->resourceServerId; |
76
|
|
|
} |
77
|
|
|
} |
78
|
|
|
|
Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a
@return
annotation as described here.