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

@@ 243-251 (lines=9) @@
240
			$finfo = finfo_open(FILEINFO_MIME);
241
			$info = finfo_buffer($finfo, $data);
242
			return strpos($info, ';') !== false ? substr($info, 0, strpos($info, ';')) : $info;
243
		} else {
244
			$tmpFile = \OC::$server->getTempManager()->getTemporaryFile();
245
			$fh = fopen($tmpFile, 'wb');
246
			fwrite($fh, $data, 8024);
247
			fclose($fh);
248
			$mime = $this->detect($tmpFile);
249
			unset($tmpFile);
250
			return $mime;
251
		}
252
	}
253
254
	/**