Code Duplication    Length = 5-6 lines in 2 locations

lib/private/legacy/helper.php 1 location

@@ 477-482 (lines=6) @@
474
	 */
475
	public static function freeSpace($dir) {
476
		$freeSpace = \OC\Files\Filesystem::free_space($dir);
477
		if ($freeSpace < \OCP\Files\FileInfo::SPACE_UNLIMITED) {
478
			$freeSpace = \max($freeSpace, 0);
479
			return $freeSpace;
480
		} else {
481
			return (INF > 0)? INF: PHP_INT_MAX; // work around https://bugs.php.net/bug.php?id=69188
482
		}
483
	}
484
485
	/**

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

@@ 332-336 (lines=5) @@
329
			 * The OC_Util methods require a view. This just uses the node API
330
			 */
331
			$freeSpace = $share->getNode()->getStorage()->free_space($share->getNode()->getInternalPath());
332
			if ($freeSpace < \OCP\Files\FileInfo::SPACE_UNLIMITED) {
333
				$freeSpace = \max($freeSpace, 0);
334
			} else {
335
				$freeSpace = (INF > 0) ? INF: PHP_INT_MAX; // work around https://bugs.php.net/bug.php?id=69188
336
			}
337
338
			$maxUploadFilesize = $freeSpace;
339