Code Duplication    Length = 13-14 lines in 2 locations

lib/private/Encryption/Keys/Storage.php 2 locations

@@ 276-289 (lines=14) @@
273
	 * @param string $path path to the file, relative to data/
274
	 * @return string
275
	 */
276
	private function getFileKeyDir($encryptionModuleId, $path) {
277
278
		list($owner, $filename) = $this->util->getUidAndFilename($path);
279
280
		// in case of system wide mount points the keys are stored directly in the data directory
281
		if ($this->util->isSystemWideMountPoint($filename, $owner)) {
282
			$keyPath = $this->root_dir . '/' . $this->keys_base_dir . $filename . '/';
283
		} else {
284
			$this->setupUserMounts($owner);
285
			$keyPath = $this->root_dir . '/' . $owner . $this->keys_base_dir . $filename . '/';
286
		}
287
288
		return Filesystem::normalizePath($keyPath . $encryptionModuleId . '/', false);
289
	}
290
291
	/**
292
	 * move keys if a file was renamed
@@ 341-353 (lines=13) @@
338
	 * @param string $path
339
	 * @return string
340
	 */
341
	protected function getPathToKeys($path) {
342
		list($owner, $relativePath) = $this->util->getUidAndFilename($path);
343
		$systemWideMountPoint = $this->util->isSystemWideMountPoint($relativePath, $owner);
344
345
		if ($systemWideMountPoint) {
346
			$systemPath = $this->root_dir . '/' . $this->keys_base_dir . $relativePath . '/';
347
		} else {
348
			$this->setupUserMounts($owner);
349
			$systemPath = $this->root_dir . '/' . $owner . $this->keys_base_dir . $relativePath . '/';
350
		}
351
352
		return  Filesystem::normalizePath($systemPath, false);
353
	}
354
355
	/**
356
	 * Make preparations to filesystem for saving a key file