Completed
Push — master ( 43ed8b...28f3fe )
by Morris
12:57
created
lib/private/legacy/helper.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -98,18 +98,18 @@  discard block
 block discarded – undo
98 98
 			return "?";
99 99
 		}
100 100
 		if ($bytes < 1024) {
101
-			return $bytes . "B";
101
+			return $bytes."B";
102 102
 		}
103 103
 		$bytes = round($bytes / 1024, 1);
104 104
 		if ($bytes < 1024) {
105
-			return $bytes . "K";
105
+			return $bytes."K";
106 106
 		}
107 107
 		$bytes = round($bytes / 1024, 1);
108 108
 		if ($bytes < 1024) {
109
-			return $bytes . "M";
109
+			return $bytes."M";
110 110
 		}
111 111
 		$bytes = round($bytes / 1024, 1);
112
-		return $bytes . "G";
112
+		return $bytes."G";
113 113
 	}
114 114
 
115 115
 	/**
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 	public static function computerFileSize($str) {
125 125
 		$str = strtolower($str);
126 126
 		if (is_numeric($str)) {
127
-			return (float)$str;
127
+			return (float) $str;
128 128
 		}
129 129
 
130 130
 		$bytes_array = array(
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 			'p' => 1024 * 1024 * 1024 * 1024 * 1024,
142 142
 		);
143 143
 
144
-		$bytes = (float)$str;
144
+		$bytes = (float) $str;
145 145
 
146 146
 		if (preg_match('#([kmgtp]?b?)$#si', $str, $matches) && !empty($bytes_array[$matches[1]])) {
147 147
 			$bytes *= $bytes_array[$matches[1]];
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
 		}
256 256
 		foreach ($dirs as $dir) {
257 257
 			foreach ($exts as $ext) {
258
-				if ($check_fn("$dir/$name" . $ext))
258
+				if ($check_fn("$dir/$name".$ext))
259 259
 					return true;
260 260
 			}
261 261
 		}
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
 			$ext = '';
327 327
 		}
328 328
 
329
-		$newpath = $path . '/' . $filename;
329
+		$newpath = $path.'/'.$filename;
330 330
 		if ($view->file_exists($newpath)) {
331 331
 			if (preg_match_all('/\((\d+)\)/', $name, $matches, PREG_OFFSET_CAPTURE)) {
332 332
 				//Replace the last "(number)" with "(number+1)"
@@ -342,11 +342,11 @@  discard block
 block discarded – undo
342 342
 			do {
343 343
 				if ($offset) {
344 344
 					//Replace the last "(number)" with "(number+1)"
345
-					$newname = substr_replace($name, '(' . $counter . ')', $offset, $match_length);
345
+					$newname = substr_replace($name, '('.$counter.')', $offset, $match_length);
346 346
 				} else {
347
-					$newname = $name . ' (' . $counter . ')';
347
+					$newname = $name.' ('.$counter.')';
348 348
 				}
349
-				$newpath = $path . '/' . $newname . $ext;
349
+				$newpath = $path.'/'.$newname.$ext;
350 350
 				$counter++;
351 351
 			} while ($view->file_exists($newpath));
352 352
 		}
@@ -409,7 +409,7 @@  discard block
 block discarded – undo
409 409
 	 * @return int number of bytes representing
410 410
 	 */
411 411
 	public static function maxUploadFilesize($dir, $freeSpace = null) {
412
-		if (is_null($freeSpace) || $freeSpace < 0){
412
+		if (is_null($freeSpace) || $freeSpace < 0) {
413 413
 			$freeSpace = self::freeSpace($dir);
414 414
 		}
415 415
 		return min($freeSpace, self::uploadLimit());
@@ -427,7 +427,7 @@  discard block
 block discarded – undo
427 427
 			$freeSpace = max($freeSpace, 0);
428 428
 			return $freeSpace;
429 429
 		} else {
430
-			return (INF > 0)? INF: PHP_INT_MAX; // work around https://bugs.php.net/bug.php?id=69188
430
+			return (INF > 0) ? INF: PHP_INT_MAX; // work around https://bugs.php.net/bug.php?id=69188
431 431
 		}
432 432
 	}
433 433
 
@@ -440,9 +440,9 @@  discard block
 block discarded – undo
440 440
 		$ini = \OC::$server->getIniWrapper();
441 441
 		$upload_max_filesize = OCP\Util::computerFileSize($ini->get('upload_max_filesize'));
442 442
 		$post_max_size = OCP\Util::computerFileSize($ini->get('post_max_size'));
443
-		if ((int)$upload_max_filesize === 0 and (int)$post_max_size === 0) {
443
+		if ((int) $upload_max_filesize === 0 and (int) $post_max_size === 0) {
444 444
 			return INF;
445
-		} elseif ((int)$upload_max_filesize === 0 or (int)$post_max_size === 0) {
445
+		} elseif ((int) $upload_max_filesize === 0 or (int) $post_max_size === 0) {
446 446
 			return max($upload_max_filesize, $post_max_size); //only the non 0 value counts
447 447
 		} else {
448 448
 			return min($upload_max_filesize, $post_max_size);
@@ -569,7 +569,7 @@  discard block
 block discarded – undo
569 569
 		$ownerId = $storage->getOwner($path);
570 570
 		$ownerDisplayName = '';
571 571
 		$owner = \OC::$server->getUserManager()->get($ownerId);
572
-		if($owner) {
572
+		if ($owner) {
573 573
 			$ownerDisplayName = $owner->getDisplayName();
574 574
 		}
575 575
 
Please login to merge, or discard this patch.