addType('ownerUid', Types::STRING); $this->addType('editorUid', Types::STRING); $this->addType('fileid', Types::INTEGER); $this->addType('version', Types::INTEGER); $this->addType('canwrite', Types::BOOLEAN); $this->addType('serverHost', Types::STRING); $this->addType('token', Types::STRING); $this->addType('expiry', Types::INTEGER); $this->addType('guestDisplayname', Types::STRING); $this->addType('templateDestination', Types::INTEGER); $this->addType('templateId', Types::INTEGER); $this->addType('hideDownload', Types::BOOLEAN); $this->addType('direct', Types::BOOLEAN); $this->addType('tokenType', Types::INTEGER); } public function hasTemplateId() { return $this->getTemplateId() !== 0 && $this->getTemplateId() !== null; } public function isGuest() { return $this->getTokenType() === Wopi::TOKEN_TYPE_GUEST || $this->getTokenType() === Wopi::TOKEN_TYPE_REMOTE_GUEST; } public function isRemoteToken() { return $this->getTokenType() === Wopi::TOKEN_TYPE_REMOTE_USER || $this->getTokenType() === Wopi::TOKEN_TYPE_REMOTE_GUEST; } public function getUserForFileAccess() { if ($this->share !== null || $this->tokenType === self::TOKEN_TYPE_REMOTE_USER || $this->tokenType === self::TOKEN_TYPE_REMOTE_GUEST) { return $this->getOwnerUid(); } return $this->isGuest() ? $this->getOwnerUid() : $this->getEditorUid(); } public function getHideDownload() { return (bool)$this->hideDownload; } public function getDirect() { return (bool)$this->direct; } #[\ReturnTypeWillChange] public function jsonSerialize() { $properties = get_object_vars($this); $reflection = new \ReflectionClass($this); $json = []; foreach ($properties as $property => $value) { if (!str_starts_with($property, '_') && $reflection->hasProperty($property)) { $propertyReflection = $reflection->getProperty($property); if (!$propertyReflection->isPrivate()) { $json[$property] = $this->getter($property); } } } return $json; } }