Completed
Push — master ( 240d91...1034ef )
by Morris
16:31
created
lib/private/legacy/helper.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 		} else {
66 66
 			$url = OC::$server->getURLGenerator()->getAbsoluteURL(OC::$server->getURLGenerator()->linkTo('', 'public.php').'?service='.$service);
67 67
 		}
68
-		return $url . (($add_slash && $service[strlen($service) - 1] != '/') ? '/' : '');
68
+		return $url.(($add_slash && $service[strlen($service) - 1] != '/') ? '/' : '');
69 69
 	}
70 70
 
71 71
 	/**
@@ -115,18 +115,18 @@  discard block
 block discarded – undo
115 115
 			return "?";
116 116
 		}
117 117
 		if ($bytes < 1024) {
118
-			return $bytes . "B";
118
+			return $bytes."B";
119 119
 		}
120 120
 		$bytes = round($bytes / 1024, 1);
121 121
 		if ($bytes < 1024) {
122
-			return $bytes . "K";
122
+			return $bytes."K";
123 123
 		}
124 124
 		$bytes = round($bytes / 1024, 1);
125 125
 		if ($bytes < 1024) {
126
-			return $bytes . "M";
126
+			return $bytes."M";
127 127
 		}
128 128
 		$bytes = round($bytes / 1024, 1);
129
-		return $bytes . "G";
129
+		return $bytes."G";
130 130
 	}
131 131
 
132 132
 	/**
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 	public static function computerFileSize($str) {
142 142
 		$str = strtolower($str);
143 143
 		if (is_numeric($str)) {
144
-			return (float)$str;
144
+			return (float) $str;
145 145
 		}
146 146
 
147 147
 		$bytes_array = array(
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 			'p' => 1024 * 1024 * 1024 * 1024 * 1024,
159 159
 		);
160 160
 
161
-		$bytes = (float)$str;
161
+		$bytes = (float) $str;
162 162
 
163 163
 		if (preg_match('#([kmgtp]?b?)$#si', $str, $matches) && !empty($bytes_array[$matches[1]])) {
164 164
 			$bytes *= $bytes_array[$matches[1]];
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
 		}
273 273
 		foreach ($dirs as $dir) {
274 274
 			foreach ($exts as $ext) {
275
-				if ($check_fn("$dir/$name" . $ext))
275
+				if ($check_fn("$dir/$name".$ext))
276 276
 					return true;
277 277
 			}
278 278
 		}
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
 			$ext = '';
344 344
 		}
345 345
 
346
-		$newpath = $path . '/' . $filename;
346
+		$newpath = $path.'/'.$filename;
347 347
 		if ($view->file_exists($newpath)) {
348 348
 			if (preg_match_all('/\((\d+)\)/', $name, $matches, PREG_OFFSET_CAPTURE)) {
349 349
 				//Replace the last "(number)" with "(number+1)"
@@ -359,11 +359,11 @@  discard block
 block discarded – undo
359 359
 			do {
360 360
 				if ($offset) {
361 361
 					//Replace the last "(number)" with "(number+1)"
362
-					$newname = substr_replace($name, '(' . $counter . ')', $offset, $match_length);
362
+					$newname = substr_replace($name, '('.$counter.')', $offset, $match_length);
363 363
 				} else {
364
-					$newname = $name . ' (' . $counter . ')';
364
+					$newname = $name.' ('.$counter.')';
365 365
 				}
366
-				$newpath = $path . '/' . $newname . $ext;
366
+				$newpath = $path.'/'.$newname.$ext;
367 367
 				$counter++;
368 368
 			} while ($view->file_exists($newpath));
369 369
 		}
@@ -426,7 +426,7 @@  discard block
 block discarded – undo
426 426
 	 * @return int number of bytes representing
427 427
 	 */
428 428
 	public static function maxUploadFilesize($dir, $freeSpace = null) {
429
-		if (is_null($freeSpace) || $freeSpace < 0){
429
+		if (is_null($freeSpace) || $freeSpace < 0) {
430 430
 			$freeSpace = self::freeSpace($dir);
431 431
 		}
432 432
 		return min($freeSpace, self::uploadLimit());
@@ -444,7 +444,7 @@  discard block
 block discarded – undo
444 444
 			$freeSpace = max($freeSpace, 0);
445 445
 			return $freeSpace;
446 446
 		} else {
447
-			return (INF > 0)? INF: PHP_INT_MAX; // work around https://bugs.php.net/bug.php?id=69188
447
+			return (INF > 0) ? INF: PHP_INT_MAX; // work around https://bugs.php.net/bug.php?id=69188
448 448
 		}
449 449
 	}
450 450
 
@@ -457,9 +457,9 @@  discard block
 block discarded – undo
457 457
 		$ini = \OC::$server->getIniWrapper();
458 458
 		$upload_max_filesize = OCP\Util::computerFileSize($ini->get('upload_max_filesize'));
459 459
 		$post_max_size = OCP\Util::computerFileSize($ini->get('post_max_size'));
460
-		if ((int)$upload_max_filesize === 0 and (int)$post_max_size === 0) {
460
+		if ((int) $upload_max_filesize === 0 and (int) $post_max_size === 0) {
461 461
 			return INF;
462
-		} elseif ((int)$upload_max_filesize === 0 or (int)$post_max_size === 0) {
462
+		} elseif ((int) $upload_max_filesize === 0 or (int) $post_max_size === 0) {
463 463
 			return max($upload_max_filesize, $post_max_size); //only the non 0 value counts
464 464
 		} else {
465 465
 			return min($upload_max_filesize, $post_max_size);
@@ -586,7 +586,7 @@  discard block
 block discarded – undo
586 586
 		$ownerId = $storage->getOwner($path);
587 587
 		$ownerDisplayName = '';
588 588
 		$owner = \OC::$server->getUserManager()->get($ownerId);
589
-		if($owner) {
589
+		if ($owner) {
590 590
 			$ownerDisplayName = $owner->getDisplayName();
591 591
 		}
592 592
 
Please login to merge, or discard this patch.