diff options
author | Robin Appelman <robin@icewind.nl> | 2016-10-31 14:38:41 +0100 |
---|---|---|
committer | Robin Appelman <robin@icewind.nl> | 2016-11-16 15:24:29 +0100 |
commit | 4c3d18a9fc255564b082cba94956a7cb8892e946 (patch) | |
tree | e67db6fc35e00a9c234c57a7a42c6c23b433fcb9 /lib/private/Authentication/Token/DefaultToken.php | |
parent | a4ea20a259dc2d98cda7b2e8d5ca08f3f1b48ff7 (diff) | |
download | nextcloud-server-4c3d18a9fc255564b082cba94956a7cb8892e946.tar.gz nextcloud-server-4c3d18a9fc255564b082cba94956a7cb8892e946.zip |
explicit types
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'lib/private/Authentication/Token/DefaultToken.php')
-rw-r--r-- | lib/private/Authentication/Token/DefaultToken.php | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/lib/private/Authentication/Token/DefaultToken.php b/lib/private/Authentication/Token/DefaultToken.php index ecfb1a44f2e..127430ea6cb 100644 --- a/lib/private/Authentication/Token/DefaultToken.php +++ b/lib/private/Authentication/Token/DefaultToken.php @@ -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); } } } |