1
|
|
|
<?php |
2
|
|
|
/* |
3
|
|
|
* This program is free software: you can redistribute it and/or modify |
4
|
|
|
* it under the terms of the GNU General Public License as published by |
5
|
|
|
* the Free Software Foundation, either version 3 of the License, or |
6
|
|
|
* (at your option) any later version. |
7
|
|
|
* |
8
|
|
|
* This program is distributed in the hope that it will be useful, |
9
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
10
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
11
|
|
|
* GNU General Public License for more details. |
12
|
|
|
* |
13
|
|
|
* You should have received a copy of the GNU General Public License |
14
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
15
|
|
|
*/ |
16
|
|
|
|
17
|
|
|
namespace Filoucrackeur\Hubic\Domain\Model; |
18
|
|
|
|
19
|
|
|
use TYPO3\CMS\Extbase\DomainObject\AbstractEntity; |
20
|
|
|
|
21
|
|
|
class Account extends AbstractEntity |
22
|
|
|
{ |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* @var string |
26
|
|
|
*/ |
27
|
|
|
protected $name; |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* @var string |
31
|
|
|
*/ |
32
|
|
|
protected $clientId; |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* @var string |
36
|
|
|
*/ |
37
|
|
|
protected $clientSecret; |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* @var string |
41
|
|
|
*/ |
42
|
|
|
protected $accessToken; |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* @var string |
46
|
|
|
*/ |
47
|
|
|
protected $refreshToken; |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* @var string |
51
|
|
|
*/ |
52
|
|
|
protected $scope; |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* @var \DateTime |
56
|
|
|
*/ |
57
|
|
|
protected $expirationDate; |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* @return string |
61
|
|
|
*/ |
62
|
1 |
|
public function getName(): string |
63
|
|
|
{ |
64
|
1 |
|
return $this->name; |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* @param string $name |
69
|
|
|
*/ |
70
|
13 |
|
public function setName(string $name) |
71
|
|
|
{ |
72
|
13 |
|
$this->name = $name; |
73
|
13 |
|
} |
74
|
|
|
|
75
|
|
|
/** |
76
|
|
|
* @return string |
77
|
|
|
*/ |
78
|
1 |
|
public function getClientId(): string |
79
|
|
|
{ |
80
|
1 |
|
return $this->clientId; |
81
|
|
|
} |
82
|
|
|
|
83
|
|
|
/** |
84
|
|
|
* @param string $clientId |
85
|
|
|
*/ |
86
|
13 |
|
public function setClientId(string $clientId) |
87
|
|
|
{ |
88
|
13 |
|
$this->clientId = $clientId; |
89
|
13 |
|
} |
90
|
|
|
|
91
|
|
|
/** |
92
|
|
|
* @return string |
93
|
|
|
*/ |
94
|
1 |
|
public function getClientSecret(): string |
95
|
|
|
{ |
96
|
1 |
|
return $this->clientSecret; |
97
|
|
|
} |
98
|
|
|
|
99
|
|
|
/** |
100
|
|
|
* @param string $clientSecret |
101
|
|
|
*/ |
102
|
13 |
|
public function setClientSecret(string $clientSecret) |
103
|
|
|
{ |
104
|
13 |
|
$this->clientSecret = $clientSecret; |
105
|
13 |
|
} |
106
|
|
|
|
107
|
|
|
/** |
108
|
|
|
* @return string |
109
|
|
|
*/ |
110
|
1 |
|
public function getAccessToken(): string |
111
|
|
|
{ |
112
|
1 |
|
return $this->accessToken; |
113
|
|
|
} |
114
|
|
|
|
115
|
|
|
/** |
116
|
|
|
* @param string $accessToken |
117
|
|
|
*/ |
118
|
13 |
|
public function setAccessToken(string $accessToken) |
119
|
|
|
{ |
120
|
13 |
|
$this->accessToken = $accessToken; |
121
|
13 |
|
} |
122
|
|
|
|
123
|
|
|
/** |
124
|
|
|
* @return string |
125
|
|
|
*/ |
126
|
1 |
|
public function getRefreshToken(): string |
127
|
|
|
{ |
128
|
1 |
|
return $this->refreshToken; |
129
|
|
|
} |
130
|
|
|
|
131
|
|
|
/** |
132
|
|
|
* @param string $refreshToken |
133
|
|
|
*/ |
134
|
13 |
|
public function setRefreshToken(string $refreshToken) |
135
|
|
|
{ |
136
|
13 |
|
$this->refreshToken = $refreshToken; |
137
|
13 |
|
} |
138
|
|
|
|
139
|
|
|
/** |
140
|
|
|
* @return string |
141
|
|
|
*/ |
142
|
1 |
|
public function getScope(): string |
143
|
|
|
{ |
144
|
1 |
|
return $this->scope; |
145
|
|
|
} |
146
|
|
|
|
147
|
|
|
/** |
148
|
|
|
* @param string $scope |
149
|
|
|
*/ |
150
|
13 |
|
public function setScope(string $scope) |
151
|
|
|
{ |
152
|
13 |
|
$this->scope = $scope; |
153
|
13 |
|
} |
154
|
|
|
|
155
|
|
|
/** |
156
|
|
|
* @return \DateTime|null |
157
|
|
|
*/ |
158
|
|
|
public function getExpirationDate(): \DateTime |
159
|
|
|
{ |
160
|
|
|
return $this->expirationDate; |
161
|
|
|
} |
162
|
|
|
|
163
|
|
|
/** |
164
|
|
|
* @param \DateTime $expirationDate |
165
|
|
|
*/ |
166
|
12 |
|
public function setExpirationDate(\DateTime $expirationDate) |
167
|
|
|
{ |
168
|
12 |
|
$this->expirationDate = $expirationDate; |
169
|
12 |
|
} |
170
|
|
|
|
171
|
|
|
/** |
172
|
|
|
* @return bool |
173
|
|
|
*/ |
174
|
|
|
public function isExpired(): bool |
175
|
|
|
{ |
176
|
|
|
return $this->getExpirationDate() < new \DateTime(); |
177
|
|
|
} |
178
|
|
|
} |
179
|
|
|
|