explicit types
Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
parent
a4ea20a259
commit
4c3d18a9fc
|
@ -92,6 +92,12 @@ class DefaultToken extends Entity implements IToken {
|
|||
*/
|
||||
protected $scope;
|
||||
|
||||
public function __construct() {
|
||||
$this->addType('type', 'int');
|
||||
$this->addType('lastActivity', 'int');
|
||||
$this->addType('lastCheck', 'int');
|
||||
}
|
||||
|
||||
public function getId() {
|
||||
return $this->id;
|
||||
}
|
||||
|
@ -122,8 +128,8 @@ class DefaultToken extends Entity implements IToken {
|
|||
return [
|
||||
'id' => $this->id,
|
||||
'name' => $this->name,
|
||||
'lastActivity' => (int)$this->lastActivity,
|
||||
'type' => (int)$this->type,
|
||||
'lastActivity' => $this->lastActivity,
|
||||
'type' => $this->type,
|
||||
'scope' => $this->getScopeAsArray()
|
||||
];
|
||||
}
|
||||
|
@ -161,10 +167,10 @@ class DefaultToken extends Entity implements IToken {
|
|||
}
|
||||
|
||||
public function setScope($scope) {
|
||||
if (is_string($scope)) {
|
||||
parent::setScope($scope);
|
||||
} else {
|
||||
if (is_array($scope)) {
|
||||
parent::setScope(json_encode($scope));
|
||||
} else {
|
||||
parent::setScope((string)$scope);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -122,7 +122,6 @@ class DefaultTokenMapperTest extends TestCase {
|
|||
}
|
||||
|
||||
public function testGetToken() {
|
||||
$token = '1504445f1524fc801035448a95681a9378ba2e83930c814546c56e5d6ebde221198792fd900c88ed5ead0555780dad1ebce3370d7e154941cd5de87eb419899b';
|
||||
$token = new DefaultToken();
|
||||
$token->setUid('user2');
|
||||
$token->setLoginName('User2');
|
||||
|
|
Loading…
Reference in New Issue