Code Duplication    Length = 8-9 lines in 2 locations

apps/files_sharing/lib/Controller/PublicPreviewController.php 1 location

@@ 67-74 (lines=8) @@
64
		return $this->share->getPassword();
65
	}
66
67
	public function isValidToken(): bool {
68
		try {
69
			$this->share = $this->shareManager->getShareByToken($this->getToken());
70
			return true;
71
		} catch (ShareNotFound $e) {
72
			return false;
73
		}
74
	}
75
76
	protected function isPasswordProtected(): bool {
77
		return $this->share->getPassword() !== null;

apps/files_sharing/lib/Controller/ShareController.php 1 location

@@ 183-191 (lines=9) @@
180
		return $this->share->getPassword();
181
	}
182
183
	public function isValidToken(): bool {
184
		try {
185
			$this->share = $this->shareManager->getShareByToken($this->getToken());
186
		} catch (ShareNotFound $e) {
187
			return false;
188
		}
189
190
		return true;
191
	}
192
193
	protected function isPasswordProtected(): bool {
194
		return $this->share->getPassword() !== null;