@@ -48,193 +48,193 @@ |
||
48 | 48 | */ |
49 | 49 | class PublicKeyToken extends Entity implements IToken { |
50 | 50 | |
51 | - const VERSION = 2; |
|
52 | - |
|
53 | - /** @var string user UID */ |
|
54 | - protected $uid; |
|
55 | - |
|
56 | - /** @var string login name used for generating the token */ |
|
57 | - protected $loginName; |
|
58 | - |
|
59 | - /** @var string encrypted user password */ |
|
60 | - protected $password; |
|
61 | - |
|
62 | - /** @var string token name (e.g. browser/OS) */ |
|
63 | - protected $name; |
|
64 | - |
|
65 | - /** @var string */ |
|
66 | - protected $token; |
|
67 | - |
|
68 | - /** @var int */ |
|
69 | - protected $type; |
|
70 | - |
|
71 | - /** @var int */ |
|
72 | - protected $remember; |
|
73 | - |
|
74 | - /** @var int */ |
|
75 | - protected $lastActivity; |
|
76 | - |
|
77 | - /** @var int */ |
|
78 | - protected $lastCheck; |
|
79 | - |
|
80 | - /** @var string */ |
|
81 | - protected $scope; |
|
82 | - |
|
83 | - /** @var int */ |
|
84 | - protected $expires; |
|
85 | - |
|
86 | - /** @var string */ |
|
87 | - protected $privateKey; |
|
88 | - |
|
89 | - /** @var string */ |
|
90 | - protected $publicKey; |
|
91 | - |
|
92 | - /** @var int */ |
|
93 | - protected $version; |
|
94 | - |
|
95 | - /** @var string */ |
|
96 | - protected $comment; |
|
97 | - |
|
98 | - public function __construct() { |
|
99 | - $this->addType('uid', 'string'); |
|
100 | - $this->addType('loginName', 'string'); |
|
101 | - $this->addType('password', 'string'); |
|
102 | - $this->addType('name', 'string'); |
|
103 | - $this->addType('token', 'string'); |
|
104 | - $this->addType('type', 'int'); |
|
105 | - $this->addType('remember', 'int'); |
|
106 | - $this->addType('lastActivity', 'int'); |
|
107 | - $this->addType('lastCheck', 'int'); |
|
108 | - $this->addType('scope', 'string'); |
|
109 | - $this->addType('expires', 'int'); |
|
110 | - $this->addType('publicKey', 'string'); |
|
111 | - $this->addType('privateKey', 'string'); |
|
112 | - $this->addType('version', 'int'); |
|
113 | - $this->addType('comment', 'string'); |
|
114 | - } |
|
115 | - |
|
116 | - public function getId(): int { |
|
117 | - return $this->id; |
|
118 | - } |
|
119 | - |
|
120 | - public function getUID(): string { |
|
121 | - return $this->uid; |
|
122 | - } |
|
123 | - |
|
124 | - /** |
|
125 | - * Get the login name used when generating the token |
|
126 | - * |
|
127 | - * @return string |
|
128 | - */ |
|
129 | - public function getLoginName(): string { |
|
130 | - return parent::getLoginName(); |
|
131 | - } |
|
132 | - |
|
133 | - /** |
|
134 | - * Get the (encrypted) login password |
|
135 | - * |
|
136 | - * @return string|null |
|
137 | - */ |
|
138 | - public function getPassword() { |
|
139 | - return parent::getPassword(); |
|
140 | - } |
|
141 | - |
|
142 | - public function jsonSerialize() { |
|
143 | - return [ |
|
144 | - 'id' => $this->id, |
|
145 | - 'name' => $this->name, |
|
146 | - 'lastActivity' => $this->lastActivity, |
|
147 | - 'type' => $this->type, |
|
148 | - 'scope' => $this->getScopeAsArray(), |
|
149 | - 'comment' => $this->getComment() |
|
150 | - ]; |
|
151 | - } |
|
152 | - |
|
153 | - /** |
|
154 | - * Get the timestamp of the last password check |
|
155 | - * |
|
156 | - * @return int |
|
157 | - */ |
|
158 | - public function getLastCheck(): int { |
|
159 | - return parent::getLastCheck(); |
|
160 | - } |
|
161 | - |
|
162 | - /** |
|
163 | - * Get the timestamp of the last password check |
|
164 | - * |
|
165 | - * @param int $time |
|
166 | - */ |
|
167 | - public function setLastCheck(int $time) { |
|
168 | - parent::setLastCheck($time); |
|
169 | - } |
|
170 | - |
|
171 | - public function getScope(): string { |
|
172 | - $scope = parent::getScope(); |
|
173 | - if ($scope === null) { |
|
174 | - return ''; |
|
175 | - } |
|
176 | - |
|
177 | - return $scope; |
|
178 | - } |
|
179 | - |
|
180 | - public function getScopeAsArray(): array { |
|
181 | - $scope = json_decode($this->getScope(), true); |
|
182 | - if (!$scope) { |
|
183 | - return [ |
|
184 | - 'filesystem'=> true |
|
185 | - ]; |
|
186 | - } |
|
187 | - return $scope; |
|
188 | - } |
|
189 | - |
|
190 | - public function setScope($scope) { |
|
191 | - if (is_array($scope)) { |
|
192 | - parent::setScope(json_encode($scope)); |
|
193 | - } else { |
|
194 | - parent::setScope((string)$scope); |
|
195 | - } |
|
196 | - } |
|
197 | - |
|
198 | - public function getName(): string { |
|
199 | - return parent::getName(); |
|
200 | - } |
|
201 | - |
|
202 | - public function getRemember(): int { |
|
203 | - return parent::getRemember(); |
|
204 | - } |
|
205 | - |
|
206 | - public function setToken(string $token) { |
|
207 | - parent::setToken($token); |
|
208 | - } |
|
209 | - |
|
210 | - public function setPassword(string $password = null) { |
|
211 | - parent::setPassword($password); |
|
212 | - } |
|
213 | - |
|
214 | - public function setExpires($expires) { |
|
215 | - parent::setExpires($expires); |
|
216 | - } |
|
217 | - |
|
218 | - /** |
|
219 | - * @return int|null |
|
220 | - */ |
|
221 | - public function getExpires() { |
|
222 | - return parent::getExpires(); |
|
223 | - } |
|
224 | - |
|
225 | - /** |
|
226 | - * Get the user-supplied comment of the token |
|
227 | - * |
|
228 | - * @return string |
|
229 | - */ |
|
230 | - public function getComment(): string { |
|
231 | - $comment = parent::getComment(); |
|
232 | - is_null($comment) && $comment = ""; |
|
233 | - return $comment; |
|
234 | - } |
|
235 | - |
|
236 | - public function setComment(string $comment = "") { |
|
237 | - parent::setComment(substr($comment,0,250)); |
|
238 | - } |
|
51 | + const VERSION = 2; |
|
52 | + |
|
53 | + /** @var string user UID */ |
|
54 | + protected $uid; |
|
55 | + |
|
56 | + /** @var string login name used for generating the token */ |
|
57 | + protected $loginName; |
|
58 | + |
|
59 | + /** @var string encrypted user password */ |
|
60 | + protected $password; |
|
61 | + |
|
62 | + /** @var string token name (e.g. browser/OS) */ |
|
63 | + protected $name; |
|
64 | + |
|
65 | + /** @var string */ |
|
66 | + protected $token; |
|
67 | + |
|
68 | + /** @var int */ |
|
69 | + protected $type; |
|
70 | + |
|
71 | + /** @var int */ |
|
72 | + protected $remember; |
|
73 | + |
|
74 | + /** @var int */ |
|
75 | + protected $lastActivity; |
|
76 | + |
|
77 | + /** @var int */ |
|
78 | + protected $lastCheck; |
|
79 | + |
|
80 | + /** @var string */ |
|
81 | + protected $scope; |
|
82 | + |
|
83 | + /** @var int */ |
|
84 | + protected $expires; |
|
85 | + |
|
86 | + /** @var string */ |
|
87 | + protected $privateKey; |
|
88 | + |
|
89 | + /** @var string */ |
|
90 | + protected $publicKey; |
|
91 | + |
|
92 | + /** @var int */ |
|
93 | + protected $version; |
|
94 | + |
|
95 | + /** @var string */ |
|
96 | + protected $comment; |
|
97 | + |
|
98 | + public function __construct() { |
|
99 | + $this->addType('uid', 'string'); |
|
100 | + $this->addType('loginName', 'string'); |
|
101 | + $this->addType('password', 'string'); |
|
102 | + $this->addType('name', 'string'); |
|
103 | + $this->addType('token', 'string'); |
|
104 | + $this->addType('type', 'int'); |
|
105 | + $this->addType('remember', 'int'); |
|
106 | + $this->addType('lastActivity', 'int'); |
|
107 | + $this->addType('lastCheck', 'int'); |
|
108 | + $this->addType('scope', 'string'); |
|
109 | + $this->addType('expires', 'int'); |
|
110 | + $this->addType('publicKey', 'string'); |
|
111 | + $this->addType('privateKey', 'string'); |
|
112 | + $this->addType('version', 'int'); |
|
113 | + $this->addType('comment', 'string'); |
|
114 | + } |
|
115 | + |
|
116 | + public function getId(): int { |
|
117 | + return $this->id; |
|
118 | + } |
|
119 | + |
|
120 | + public function getUID(): string { |
|
121 | + return $this->uid; |
|
122 | + } |
|
123 | + |
|
124 | + /** |
|
125 | + * Get the login name used when generating the token |
|
126 | + * |
|
127 | + * @return string |
|
128 | + */ |
|
129 | + public function getLoginName(): string { |
|
130 | + return parent::getLoginName(); |
|
131 | + } |
|
132 | + |
|
133 | + /** |
|
134 | + * Get the (encrypted) login password |
|
135 | + * |
|
136 | + * @return string|null |
|
137 | + */ |
|
138 | + public function getPassword() { |
|
139 | + return parent::getPassword(); |
|
140 | + } |
|
141 | + |
|
142 | + public function jsonSerialize() { |
|
143 | + return [ |
|
144 | + 'id' => $this->id, |
|
145 | + 'name' => $this->name, |
|
146 | + 'lastActivity' => $this->lastActivity, |
|
147 | + 'type' => $this->type, |
|
148 | + 'scope' => $this->getScopeAsArray(), |
|
149 | + 'comment' => $this->getComment() |
|
150 | + ]; |
|
151 | + } |
|
152 | + |
|
153 | + /** |
|
154 | + * Get the timestamp of the last password check |
|
155 | + * |
|
156 | + * @return int |
|
157 | + */ |
|
158 | + public function getLastCheck(): int { |
|
159 | + return parent::getLastCheck(); |
|
160 | + } |
|
161 | + |
|
162 | + /** |
|
163 | + * Get the timestamp of the last password check |
|
164 | + * |
|
165 | + * @param int $time |
|
166 | + */ |
|
167 | + public function setLastCheck(int $time) { |
|
168 | + parent::setLastCheck($time); |
|
169 | + } |
|
170 | + |
|
171 | + public function getScope(): string { |
|
172 | + $scope = parent::getScope(); |
|
173 | + if ($scope === null) { |
|
174 | + return ''; |
|
175 | + } |
|
176 | + |
|
177 | + return $scope; |
|
178 | + } |
|
179 | + |
|
180 | + public function getScopeAsArray(): array { |
|
181 | + $scope = json_decode($this->getScope(), true); |
|
182 | + if (!$scope) { |
|
183 | + return [ |
|
184 | + 'filesystem'=> true |
|
185 | + ]; |
|
186 | + } |
|
187 | + return $scope; |
|
188 | + } |
|
189 | + |
|
190 | + public function setScope($scope) { |
|
191 | + if (is_array($scope)) { |
|
192 | + parent::setScope(json_encode($scope)); |
|
193 | + } else { |
|
194 | + parent::setScope((string)$scope); |
|
195 | + } |
|
196 | + } |
|
197 | + |
|
198 | + public function getName(): string { |
|
199 | + return parent::getName(); |
|
200 | + } |
|
201 | + |
|
202 | + public function getRemember(): int { |
|
203 | + return parent::getRemember(); |
|
204 | + } |
|
205 | + |
|
206 | + public function setToken(string $token) { |
|
207 | + parent::setToken($token); |
|
208 | + } |
|
209 | + |
|
210 | + public function setPassword(string $password = null) { |
|
211 | + parent::setPassword($password); |
|
212 | + } |
|
213 | + |
|
214 | + public function setExpires($expires) { |
|
215 | + parent::setExpires($expires); |
|
216 | + } |
|
217 | + |
|
218 | + /** |
|
219 | + * @return int|null |
|
220 | + */ |
|
221 | + public function getExpires() { |
|
222 | + return parent::getExpires(); |
|
223 | + } |
|
224 | + |
|
225 | + /** |
|
226 | + * Get the user-supplied comment of the token |
|
227 | + * |
|
228 | + * @return string |
|
229 | + */ |
|
230 | + public function getComment(): string { |
|
231 | + $comment = parent::getComment(); |
|
232 | + is_null($comment) && $comment = ""; |
|
233 | + return $comment; |
|
234 | + } |
|
235 | + |
|
236 | + public function setComment(string $comment = "") { |
|
237 | + parent::setComment(substr($comment,0,250)); |
|
238 | + } |
|
239 | 239 | |
240 | 240 | } |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | if (is_array($scope)) { |
192 | 192 | parent::setScope(json_encode($scope)); |
193 | 193 | } else { |
194 | - parent::setScope((string)$scope); |
|
194 | + parent::setScope((string) $scope); |
|
195 | 195 | } |
196 | 196 | } |
197 | 197 | |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | } |
235 | 235 | |
236 | 236 | public function setComment(string $comment = "") { |
237 | - parent::setComment(substr($comment,0,250)); |
|
237 | + parent::setComment(substr($comment, 0, 250)); |
|
238 | 238 | } |
239 | 239 | |
240 | 240 | } |
@@ -43,185 +43,185 @@ |
||
43 | 43 | */ |
44 | 44 | class DefaultToken extends Entity implements IToken { |
45 | 45 | |
46 | - const VERSION = 1; |
|
47 | - |
|
48 | - /** @var string user UID */ |
|
49 | - protected $uid; |
|
50 | - |
|
51 | - /** @var string login name used for generating the token */ |
|
52 | - protected $loginName; |
|
53 | - |
|
54 | - /** @var string encrypted user password */ |
|
55 | - protected $password; |
|
56 | - |
|
57 | - /** @var string token name (e.g. browser/OS) */ |
|
58 | - protected $name; |
|
59 | - |
|
60 | - /** @var string */ |
|
61 | - protected $token; |
|
62 | - |
|
63 | - /** @var int */ |
|
64 | - protected $type; |
|
65 | - |
|
66 | - /** @var int */ |
|
67 | - protected $remember; |
|
68 | - |
|
69 | - /** @var int */ |
|
70 | - protected $lastActivity; |
|
71 | - |
|
72 | - /** @var int */ |
|
73 | - protected $lastCheck; |
|
74 | - |
|
75 | - /** @var string */ |
|
76 | - protected $scope; |
|
77 | - |
|
78 | - /** @var int */ |
|
79 | - protected $expires; |
|
80 | - |
|
81 | - /** @var int */ |
|
82 | - protected $version; |
|
83 | - |
|
84 | - /** @var string */ |
|
85 | - protected $comment; |
|
86 | - |
|
87 | - public function __construct() { |
|
88 | - $this->addType('uid', 'string'); |
|
89 | - $this->addType('loginName', 'string'); |
|
90 | - $this->addType('password', 'string'); |
|
91 | - $this->addType('name', 'string'); |
|
92 | - $this->addType('token', 'string'); |
|
93 | - $this->addType('type', 'int'); |
|
94 | - $this->addType('remember', 'int'); |
|
95 | - $this->addType('lastActivity', 'int'); |
|
96 | - $this->addType('lastCheck', 'int'); |
|
97 | - $this->addType('scope', 'string'); |
|
98 | - $this->addType('expires', 'int'); |
|
99 | - $this->addType('version', 'int'); |
|
100 | - $this->addType('comment', 'string'); |
|
101 | - } |
|
102 | - |
|
103 | - public function getId(): int { |
|
104 | - return $this->id; |
|
105 | - } |
|
106 | - |
|
107 | - public function getUID(): string { |
|
108 | - return $this->uid; |
|
109 | - } |
|
110 | - |
|
111 | - /** |
|
112 | - * Get the login name used when generating the token |
|
113 | - * |
|
114 | - * @return string |
|
115 | - */ |
|
116 | - public function getLoginName(): string { |
|
117 | - return parent::getLoginName(); |
|
118 | - } |
|
119 | - |
|
120 | - /** |
|
121 | - * Get the (encrypted) login password |
|
122 | - * |
|
123 | - * @return string|null |
|
124 | - */ |
|
125 | - public function getPassword() { |
|
126 | - return parent::getPassword(); |
|
127 | - } |
|
128 | - |
|
129 | - public function jsonSerialize() { |
|
130 | - return [ |
|
131 | - 'id' => $this->id, |
|
132 | - 'name' => $this->name, |
|
133 | - 'lastActivity' => $this->lastActivity, |
|
134 | - 'type' => $this->type, |
|
135 | - 'scope' => $this->getScopeAsArray(), |
|
136 | - 'comment' => $this->getComment() |
|
137 | - ]; |
|
138 | - } |
|
139 | - |
|
140 | - /** |
|
141 | - * Get the timestamp of the last password check |
|
142 | - * |
|
143 | - * @return int |
|
144 | - */ |
|
145 | - public function getLastCheck(): int { |
|
146 | - return parent::getLastCheck(); |
|
147 | - } |
|
148 | - |
|
149 | - /** |
|
150 | - * Get the timestamp of the last password check |
|
151 | - * |
|
152 | - * @param int $time |
|
153 | - */ |
|
154 | - public function setLastCheck(int $time) { |
|
155 | - parent::setLastCheck($time); |
|
156 | - } |
|
157 | - |
|
158 | - public function getScope(): string { |
|
159 | - $scope = parent::getScope(); |
|
160 | - if ($scope === null) { |
|
161 | - return ''; |
|
162 | - } |
|
163 | - |
|
164 | - return $scope; |
|
165 | - } |
|
166 | - |
|
167 | - public function getScopeAsArray(): array { |
|
168 | - $scope = json_decode($this->getScope(), true); |
|
169 | - if (!$scope) { |
|
170 | - return [ |
|
171 | - 'filesystem'=> true |
|
172 | - ]; |
|
173 | - } |
|
174 | - return $scope; |
|
175 | - } |
|
176 | - |
|
177 | - public function setScope($scope) { |
|
178 | - if (\is_array($scope)) { |
|
179 | - parent::setScope(json_encode($scope)); |
|
180 | - } else { |
|
181 | - parent::setScope((string)$scope); |
|
182 | - } |
|
183 | - } |
|
184 | - |
|
185 | - public function getName(): string { |
|
186 | - return parent::getName(); |
|
187 | - } |
|
188 | - |
|
189 | - public function getRemember(): int { |
|
190 | - return parent::getRemember(); |
|
191 | - } |
|
192 | - |
|
193 | - public function setToken(string $token) { |
|
194 | - parent::setToken($token); |
|
195 | - } |
|
196 | - |
|
197 | - public function setPassword(string $password = null) { |
|
198 | - parent::setPassword($password); |
|
199 | - } |
|
200 | - |
|
201 | - public function setExpires($expires) { |
|
202 | - parent::setExpires($expires); |
|
203 | - } |
|
204 | - |
|
205 | - /** |
|
206 | - * @return int|null |
|
207 | - */ |
|
208 | - public function getExpires() { |
|
209 | - return parent::getExpires(); |
|
210 | - } |
|
211 | - |
|
212 | - /** |
|
213 | - * Get the user-supplied comment of the token |
|
214 | - * |
|
215 | - * @return string |
|
216 | - */ |
|
217 | - public function getComment(): string { |
|
218 | - $comment = parent::getComment(); |
|
219 | - is_null($comment) && $comment = ""; |
|
220 | - return $comment; |
|
221 | - } |
|
222 | - |
|
223 | - public function setComment(string $comment = "") { |
|
224 | - parent::setComment(substr($comment,0,250)); |
|
225 | - } |
|
46 | + const VERSION = 1; |
|
47 | + |
|
48 | + /** @var string user UID */ |
|
49 | + protected $uid; |
|
50 | + |
|
51 | + /** @var string login name used for generating the token */ |
|
52 | + protected $loginName; |
|
53 | + |
|
54 | + /** @var string encrypted user password */ |
|
55 | + protected $password; |
|
56 | + |
|
57 | + /** @var string token name (e.g. browser/OS) */ |
|
58 | + protected $name; |
|
59 | + |
|
60 | + /** @var string */ |
|
61 | + protected $token; |
|
62 | + |
|
63 | + /** @var int */ |
|
64 | + protected $type; |
|
65 | + |
|
66 | + /** @var int */ |
|
67 | + protected $remember; |
|
68 | + |
|
69 | + /** @var int */ |
|
70 | + protected $lastActivity; |
|
71 | + |
|
72 | + /** @var int */ |
|
73 | + protected $lastCheck; |
|
74 | + |
|
75 | + /** @var string */ |
|
76 | + protected $scope; |
|
77 | + |
|
78 | + /** @var int */ |
|
79 | + protected $expires; |
|
80 | + |
|
81 | + /** @var int */ |
|
82 | + protected $version; |
|
83 | + |
|
84 | + /** @var string */ |
|
85 | + protected $comment; |
|
86 | + |
|
87 | + public function __construct() { |
|
88 | + $this->addType('uid', 'string'); |
|
89 | + $this->addType('loginName', 'string'); |
|
90 | + $this->addType('password', 'string'); |
|
91 | + $this->addType('name', 'string'); |
|
92 | + $this->addType('token', 'string'); |
|
93 | + $this->addType('type', 'int'); |
|
94 | + $this->addType('remember', 'int'); |
|
95 | + $this->addType('lastActivity', 'int'); |
|
96 | + $this->addType('lastCheck', 'int'); |
|
97 | + $this->addType('scope', 'string'); |
|
98 | + $this->addType('expires', 'int'); |
|
99 | + $this->addType('version', 'int'); |
|
100 | + $this->addType('comment', 'string'); |
|
101 | + } |
|
102 | + |
|
103 | + public function getId(): int { |
|
104 | + return $this->id; |
|
105 | + } |
|
106 | + |
|
107 | + public function getUID(): string { |
|
108 | + return $this->uid; |
|
109 | + } |
|
110 | + |
|
111 | + /** |
|
112 | + * Get the login name used when generating the token |
|
113 | + * |
|
114 | + * @return string |
|
115 | + */ |
|
116 | + public function getLoginName(): string { |
|
117 | + return parent::getLoginName(); |
|
118 | + } |
|
119 | + |
|
120 | + /** |
|
121 | + * Get the (encrypted) login password |
|
122 | + * |
|
123 | + * @return string|null |
|
124 | + */ |
|
125 | + public function getPassword() { |
|
126 | + return parent::getPassword(); |
|
127 | + } |
|
128 | + |
|
129 | + public function jsonSerialize() { |
|
130 | + return [ |
|
131 | + 'id' => $this->id, |
|
132 | + 'name' => $this->name, |
|
133 | + 'lastActivity' => $this->lastActivity, |
|
134 | + 'type' => $this->type, |
|
135 | + 'scope' => $this->getScopeAsArray(), |
|
136 | + 'comment' => $this->getComment() |
|
137 | + ]; |
|
138 | + } |
|
139 | + |
|
140 | + /** |
|
141 | + * Get the timestamp of the last password check |
|
142 | + * |
|
143 | + * @return int |
|
144 | + */ |
|
145 | + public function getLastCheck(): int { |
|
146 | + return parent::getLastCheck(); |
|
147 | + } |
|
148 | + |
|
149 | + /** |
|
150 | + * Get the timestamp of the last password check |
|
151 | + * |
|
152 | + * @param int $time |
|
153 | + */ |
|
154 | + public function setLastCheck(int $time) { |
|
155 | + parent::setLastCheck($time); |
|
156 | + } |
|
157 | + |
|
158 | + public function getScope(): string { |
|
159 | + $scope = parent::getScope(); |
|
160 | + if ($scope === null) { |
|
161 | + return ''; |
|
162 | + } |
|
163 | + |
|
164 | + return $scope; |
|
165 | + } |
|
166 | + |
|
167 | + public function getScopeAsArray(): array { |
|
168 | + $scope = json_decode($this->getScope(), true); |
|
169 | + if (!$scope) { |
|
170 | + return [ |
|
171 | + 'filesystem'=> true |
|
172 | + ]; |
|
173 | + } |
|
174 | + return $scope; |
|
175 | + } |
|
176 | + |
|
177 | + public function setScope($scope) { |
|
178 | + if (\is_array($scope)) { |
|
179 | + parent::setScope(json_encode($scope)); |
|
180 | + } else { |
|
181 | + parent::setScope((string)$scope); |
|
182 | + } |
|
183 | + } |
|
184 | + |
|
185 | + public function getName(): string { |
|
186 | + return parent::getName(); |
|
187 | + } |
|
188 | + |
|
189 | + public function getRemember(): int { |
|
190 | + return parent::getRemember(); |
|
191 | + } |
|
192 | + |
|
193 | + public function setToken(string $token) { |
|
194 | + parent::setToken($token); |
|
195 | + } |
|
196 | + |
|
197 | + public function setPassword(string $password = null) { |
|
198 | + parent::setPassword($password); |
|
199 | + } |
|
200 | + |
|
201 | + public function setExpires($expires) { |
|
202 | + parent::setExpires($expires); |
|
203 | + } |
|
204 | + |
|
205 | + /** |
|
206 | + * @return int|null |
|
207 | + */ |
|
208 | + public function getExpires() { |
|
209 | + return parent::getExpires(); |
|
210 | + } |
|
211 | + |
|
212 | + /** |
|
213 | + * Get the user-supplied comment of the token |
|
214 | + * |
|
215 | + * @return string |
|
216 | + */ |
|
217 | + public function getComment(): string { |
|
218 | + $comment = parent::getComment(); |
|
219 | + is_null($comment) && $comment = ""; |
|
220 | + return $comment; |
|
221 | + } |
|
222 | + |
|
223 | + public function setComment(string $comment = "") { |
|
224 | + parent::setComment(substr($comment,0,250)); |
|
225 | + } |
|
226 | 226 | |
227 | 227 | } |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | if (\is_array($scope)) { |
179 | 179 | parent::setScope(json_encode($scope)); |
180 | 180 | } else { |
181 | - parent::setScope((string)$scope); |
|
181 | + parent::setScope((string) $scope); |
|
182 | 182 | } |
183 | 183 | } |
184 | 184 | |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | } |
222 | 222 | |
223 | 223 | public function setComment(string $comment = "") { |
224 | - parent::setComment(substr($comment,0,250)); |
|
224 | + parent::setComment(substr($comment, 0, 250)); |
|
225 | 225 | } |
226 | 226 | |
227 | 227 | } |