Code Duplication    Length = 5-6 lines in 2 locations

lib/private/legacy/helper.php 1 location

@@ 443-448 (lines=6) @@
440
	 */
441
	public static function freeSpace($dir) {
442
		$freeSpace = \OC\Files\Filesystem::free_space($dir);
443
		if ($freeSpace < \OCP\Files\FileInfo::SPACE_UNLIMITED) {
444
			$freeSpace = max($freeSpace, 0);
445
			return $freeSpace;
446
		} else {
447
			return (INF > 0)? INF: PHP_INT_MAX; // work around https://bugs.php.net/bug.php?id=69188
448
		}
449
	}
450
451
	/**

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

@@ 324-328 (lines=5) @@
321
			 * The OC_Util methods require a view. This just uses the node API
322
			 */
323
			$freeSpace = $share->getNode()->getStorage()->free_space($share->getNode()->getInternalPath());
324
			if ($freeSpace < \OCP\Files\FileInfo::SPACE_UNLIMITED) {
325
				$freeSpace = max($freeSpace, 0);
326
			} else {
327
				$freeSpace = (INF > 0) ? INF: PHP_INT_MAX; // work around https://bugs.php.net/bug.php?id=69188
328
			}
329
330
			$hideFileList = !($share->getPermissions() & \OCP\Constants::PERMISSION_READ);
331
			$maxUploadFilesize = $freeSpace;