*/
protected $scope;
+ public function __construct() {
+ $this->addType('type', 'int');
+ $this->addType('lastActivity', 'int');
+ $this->addType('lastCheck', 'int');
+ }
+
public function getId() {
return $this->id;
}
return [
'id' => $this->id,
'name' => $this->name,
- 'lastActivity' => (int)$this->lastActivity,
- 'type' => (int)$this->type,
+ 'lastActivity' => $this->lastActivity,
+ 'type' => $this->type,
'scope' => $this->getScopeAsArray()
];
}
}
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);
}
}
}
}
public function testGetToken() {
- $token = '1504445f1524fc801035448a95681a9378ba2e83930c814546c56e5d6ebde221198792fd900c88ed5ead0555780dad1ebce3370d7e154941cd5de87eb419899b';
$token = new DefaultToken();
$token->setUid('user2');
$token->setLoginName('User2');