Code Duplication    Length = 9-10 lines in 2 locations

lib/private/Preview/Movie.php 1 location

@@ 50-59 (lines=10) @@
47
48
		if ($useFileDirectly) {
49
			$absPath = $fileview->getLocalFile($path);
50
		} else {
51
			$absPath = \OC::$server->getTempManager()->getTemporaryFile();
52
53
			$handle = $fileview->fopen($path, 'rb');
54
55
			// we better use 5MB (1024 * 1024 * 5 = 5242880) instead of 1MB.
56
			// in some cases 1MB was no enough to generate thumbnail
57
			$firstmb = stream_get_contents($handle, 5242880);
58
			file_put_contents($absPath, $firstmb);
59
		}
60
61
		$result = $this->generateThumbNail($maxX, $maxY, $absPath, 5);
62
		if ($result === false) {

lib/private/Files/Type/Detection.php 1 location

@@ 253-261 (lines=9) @@
250
			$finfo = finfo_open(FILEINFO_MIME);
251
			$info = finfo_buffer($finfo, $data);
252
			return strpos($info, ';') !== false ? substr($info, 0, strpos($info, ';')) : $info;
253
		} else {
254
			$tmpFile = \OC::$server->getTempManager()->getTemporaryFile();
255
			$fh = fopen($tmpFile, 'wb');
256
			fwrite($fh, $data, 8024);
257
			fclose($fh);
258
			$mime = $this->detect($tmpFile);
259
			unset($tmpFile);
260
			return $mime;
261
		}
262
	}
263
264
	/**