Completed
Pull Request — master (#6788)
by Markus
14:10
created
apps/dav/lib/CardDAV/PhotoCache.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 					$ext = 'gif';
82 82
 					break;
83 83
 			}
84
-			$file = $folder->newFile('photo.' . $ext);
84
+			$file = $folder->newFile('photo.'.$ext);
85 85
 			$file->putContent($data['body']);
86 86
 		}
87 87
 	}
@@ -94,9 +94,9 @@  discard block
 block discarded – undo
94 94
 		$ext = $this->getExtension($folder);
95 95
 
96 96
 		if ($size === -1) {
97
-			$path = 'photo.' . $ext;
97
+			$path = 'photo.'.$ext;
98 98
 		} else {
99
-			$path = 'photo.' . $size . '.' . $ext;
99
+			$path = 'photo.'.$size.'.'.$ext;
100 100
 		}
101 101
 
102 102
 		try {
@@ -108,14 +108,14 @@  discard block
 block discarded – undo
108 108
 
109 109
 			$photo = new \OC_Image();
110 110
 			/** @var ISimpleFile $file */
111
-			$file = $folder->getFile('photo.' . $ext);
111
+			$file = $folder->getFile('photo.'.$ext);
112 112
 			$photo->loadFromData($file->getContent());
113 113
 
114 114
 			$ratio = $photo->width() / $photo->height();
115 115
 			if ($ratio < 1) {
116
-				$ratio = 1/$ratio;
116
+				$ratio = 1 / $ratio;
117 117
 			}
118
-			$size = (int)($size * $ratio);
118
+			$size = (int) ($size * $ratio);
119 119
 
120 120
 			if ($size !== -1) {
121 121
 				$photo->resize($size);
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
 	 * @return ISimpleFolder
139 139
 	 */
140 140
 	private function getFolder($addressBookId, $cardUri) {
141
-		$hash = md5($addressBookId . ' ' . $cardUri);
141
+		$hash = md5($addressBookId.' '.$cardUri);
142 142
 		try {
143 143
 			return $this->appData->getFolder($hash);
144 144
 		} catch (NotFoundException $e) {
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
 				'image/gif',
194 194
 			];
195 195
 
196
-			if(!in_array($type, $allowedContentTypes, true)) {
196
+			if (!in_array($type, $allowedContentTypes, true)) {
197 197
 				$type = 'application/octet-stream';
198 198
 			}
199 199
 
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
 				'Content-Type' => $type,
202 202
 				'body' => $val
203 203
 			];
204
-		} catch(\Exception $ex) {
204
+		} catch (\Exception $ex) {
205 205
 
206 206
 		}
207 207
 		return false;
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
 			if (strpos($type, 'image/') === 0) {
230 230
 				return $type;
231 231
 			} else {
232
-				return 'image/' . strtolower($type);
232
+				return 'image/'.strtolower($type);
233 233
 			}
234 234
 		}
235 235
 		return '';
Please login to merge, or discard this patch.
apps/dav/lib/CardDAV/ImageExportPlugin.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 			return true;
73 73
 		}
74 74
 
75
-		$size = isset($queryParams['size']) ? (int)$queryParams['size'] : -1;
75
+		$size = isset($queryParams['size']) ? (int) $queryParams['size'] : -1;
76 76
 
77 77
 		$path = $request->getPath();
78 78
 		$node = $this->server->tree->getNodeForPath($path);
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 		$addressbook = $this->server->tree->getNodeForPath($addressbookpath);
98 98
 
99 99
 		$response->setHeader('Cache-Control', 'private, max-age=3600, must-revalidate');
100
-		$response->setHeader('Etag', $node->getETag() );
100
+		$response->setHeader('Etag', $node->getETag());
101 101
 		$response->setHeader('Pragma', 'public');
102 102
 
103 103
 		try {
Please login to merge, or discard this patch.
lib/private/Config.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 	 * @return mixed the value or $default
86 86
 	 */
87 87
 	public function getValue($key, $default = null) {
88
-		$envValue = getenv(self::ENV_PREFIX . $key);
88
+		$envValue = getenv(self::ENV_PREFIX.$key);
89 89
 		if ($envValue !== false) {
90 90
 			return $envValue;
91 91
 		}
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 		foreach ($configFiles as $file) {
198 198
 			$fileExistsAndIsReadable = file_exists($file) && is_readable($file);
199 199
 			$filePointer = $fileExistsAndIsReadable ? fopen($file, 'r') : false;
200
-			if($file === $this->configFilePath &&
200
+			if ($file === $this->configFilePath &&
201 201
 				$filePointer === false) {
202 202
 				// Opening the main config might not be possible, e.g. if the wrong
203 203
 				// permissions are set (likely on a new installation)
@@ -205,13 +205,13 @@  discard block
 block discarded – undo
205 205
 			}
206 206
 
207 207
 			// Try to acquire a file lock
208
-			if(!flock($filePointer, LOCK_SH)) {
208
+			if (!flock($filePointer, LOCK_SH)) {
209 209
 				throw new \Exception(sprintf('Could not acquire a shared lock on the config file %s', $file));
210 210
 			}
211 211
 
212 212
 			unset($CONFIG);
213 213
 			include $file;
214
-			if(isset($CONFIG) && is_array($CONFIG)) {
214
+			if (isset($CONFIG) && is_array($CONFIG)) {
215 215
 				$this->cache = array_merge($this->cache, $CONFIG);
216 216
 			}
217 217
 
@@ -236,29 +236,29 @@  discard block
 block discarded – undo
236 236
 		$content .= var_export($this->cache, true);
237 237
 		$content .= ";\n";
238 238
 
239
-		touch ($this->configFilePath);
239
+		touch($this->configFilePath);
240 240
 		$filePointer = fopen($this->configFilePath, 'r+');
241 241
 
242 242
 		// Prevent others not to read the config
243 243
 		chmod($this->configFilePath, 0640);
244 244
 
245 245
 		// File does not exist, this can happen when doing a fresh install
246
-		if(!is_resource ($filePointer)) {
246
+		if (!is_resource($filePointer)) {
247 247
 			// TODO fix this via DI once it is very clear that this doesn't cause side effects due to initialization order
248 248
 			// currently this breaks app routes but also could have other side effects especially during setup and exception handling
249 249
 			$url = \OC::$server->getURLGenerator()->linkToDocs('admin-dir_permissions');
250 250
 			throw new HintException(
251 251
 				"Can't write into config directory!",
252
-				'This can usually be fixed by giving the webserver write access to the config directory. See ' . $url);
252
+				'This can usually be fixed by giving the webserver write access to the config directory. See '.$url);
253 253
 		}
254 254
 
255 255
 		// Try to acquire a file lock
256
-		if(!flock($filePointer, LOCK_EX)) {
256
+		if (!flock($filePointer, LOCK_EX)) {
257 257
 			throw new \Exception(sprintf('Could not acquire an exclusive lock on the config file %s', $this->configFilePath));
258 258
 		}
259 259
 
260 260
 		// Write the config and release the lock
261
-		ftruncate ($filePointer, 0);
261
+		ftruncate($filePointer, 0);
262 262
 		fwrite($filePointer, $content);
263 263
 		fflush($filePointer);
264 264
 		flock($filePointer, LOCK_UN);
Please login to merge, or discard this patch.
lib/private/App/CodeChecker/LanguageParseChecker.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -35,12 +35,12 @@  discard block
 block discarded – undo
35 35
 			throw new \RuntimeException("No app with given id <$appId> known.");
36 36
 		}
37 37
 
38
-		if (!is_dir($appPath . '/l10n/')) {
38
+		if (!is_dir($appPath.'/l10n/')) {
39 39
 			return [];
40 40
 		}
41 41
 
42 42
 		$errors = [];
43
-		$directory = new \DirectoryIterator($appPath . '/l10n/');
43
+		$directory = new \DirectoryIterator($appPath.'/l10n/');
44 44
 
45 45
 		foreach ($directory as $file) {
46 46
 			if ($file->getExtension() !== 'json') {
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 			json_decode($content, true);
52 52
 
53 53
 			if (json_last_error() !== JSON_ERROR_NONE) {
54
-				$errors[] = 'Invalid language file found: l10n/' . $file->getFilename() . ': ' . json_last_error_msg();
54
+				$errors[] = 'Invalid language file found: l10n/'.$file->getFilename().': '.json_last_error_msg();
55 55
 			}
56 56
 		}
57 57
 
Please login to merge, or discard this patch.
core/Application.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@
 block discarded – undo
45 45
 
46 46
 		$container = $this->getContainer();
47 47
 
48
-		$container->registerService('defaultMailAddress', function () {
48
+		$container->registerService('defaultMailAddress', function() {
49 49
 			return Util::getDefaultEmailAddress('lostpassword-noreply');
50 50
 		});
51 51
 	}
Please login to merge, or discard this patch.
settings/Application.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 	/**
53 53
 	 * @param array $urlParams
54 54
 	 */
55
-	public function __construct(array $urlParams=[]){
55
+	public function __construct(array $urlParams = []) {
56 56
 		parent::__construct('settings', $urlParams);
57 57
 
58 58
 		$container = $this->getContainer();
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 		$container->registerService('isSubAdmin', function(IContainer $c) {
73 73
 			$userObject = \OC::$server->getUserSession()->getUser();
74 74
 			$isSubAdmin = false;
75
-			if($userObject !== null) {
75
+			if ($userObject !== null) {
76 76
 				$isSubAdmin = \OC::$server->getGroupManager()->getSubAdmin()->isSubAdmin($userObject);
77 77
 			}
78 78
 			return $isSubAdmin;
@@ -80,17 +80,17 @@  discard block
 block discarded – undo
80 80
 		$container->registerService('userCertificateManager', function(IContainer $c) {
81 81
 			return $c->query('ServerContainer')->getCertificateManager();
82 82
 		}, false);
83
-		$container->registerService('systemCertificateManager', function (IContainer $c) {
83
+		$container->registerService('systemCertificateManager', function(IContainer $c) {
84 84
 			return $c->query('ServerContainer')->getCertificateManager(null);
85 85
 		}, false);
86
-		$container->registerService(IProvider::class, function (IContainer $c) {
86
+		$container->registerService(IProvider::class, function(IContainer $c) {
87 87
 			return $c->query('ServerContainer')->query(IProvider::class);
88 88
 		});
89
-		$container->registerService(IManager::class, function (IContainer $c) {
89
+		$container->registerService(IManager::class, function(IContainer $c) {
90 90
 			return $c->query('ServerContainer')->getSettingsManager();
91 91
 		});
92 92
 
93
-		$container->registerService(NewUserMailHelper::class, function (IContainer $c) {
93
+		$container->registerService(NewUserMailHelper::class, function(IContainer $c) {
94 94
 			/** @var Server $server */
95 95
 			$server = $c->query('ServerContainer');
96 96
 			/** @var Defaults $defaults */
Please login to merge, or discard this patch.
lib/private/App/CodeChecker/DatabaseSchemaChecker.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -35,13 +35,13 @@  discard block
 block discarded – undo
35 35
 			throw new \RuntimeException("No app with given id <$appId> known.");
36 36
 		}
37 37
 
38
-		if (!file_exists($appPath . '/appinfo/database.xml')) {
38
+		if (!file_exists($appPath.'/appinfo/database.xml')) {
39 39
 			return ['errors' => [], 'warnings' => []];
40 40
 		}
41 41
 
42 42
 		libxml_use_internal_errors(true);
43 43
 		$loadEntities = libxml_disable_entity_loader(false);
44
-		$xml = simplexml_load_file($appPath . '/appinfo/database.xml');
44
+		$xml = simplexml_load_file($appPath.'/appinfo/database.xml');
45 45
 		libxml_disable_entity_loader($loadEntities);
46 46
 
47 47
 
@@ -50,15 +50,15 @@  discard block
 block discarded – undo
50 50
 		foreach ($xml->table as $table) {
51 51
 			// Table names
52 52
 			if (strpos($table->name, '*dbprefix*') !== 0) {
53
-				$errors[] = 'Database schema error: name of table ' . $table->name . ' does not start with *dbprefix*';
53
+				$errors[] = 'Database schema error: name of table '.$table->name.' does not start with *dbprefix*';
54 54
 			}
55 55
 			$tableName = substr($table->name, strlen('*dbprefix*'));
56 56
 			if (strpos($tableName, '*dbprefix*') !== false) {
57
-				$warnings[] = 'Database schema warning: *dbprefix* should only appear once in name of table ' . $table->name;
57
+				$warnings[] = 'Database schema warning: *dbprefix* should only appear once in name of table '.$table->name;
58 58
 			}
59 59
 
60 60
 			if (strlen($tableName) > 27) {
61
-				$errors[] = 'Database schema error: Name of table ' . $table->name . ' is too long (' . strlen($tableName) . '), max. 27 characters (21 characters for tables with autoincrement) + *dbprefix* allowed';
61
+				$errors[] = 'Database schema error: Name of table '.$table->name.' is too long ('.strlen($tableName).'), max. 27 characters (21 characters for tables with autoincrement) + *dbprefix* allowed';
62 62
 			}
63 63
 
64 64
 			$hasAutoIncrement = false;
@@ -66,20 +66,20 @@  discard block
 block discarded – undo
66 66
 			// Column names
67 67
 			foreach ($table->declaration->field as $column) {
68 68
 				if (strpos($column->name, '*dbprefix*') !== false) {
69
-					$warnings[] = 'Database schema warning: *dbprefix* should not appear in name of column ' . $column->name . ' on table ' . $table->name;
69
+					$warnings[] = 'Database schema warning: *dbprefix* should not appear in name of column '.$column->name.' on table '.$table->name;
70 70
 				}
71 71
 
72 72
 				if (strlen($column->name) > 30) {
73
-					$errors[] = 'Database schema error: Name of column ' . $column->name . ' on table ' . $table->name . ' is too long (' . strlen($tableName) . '), max. 30 characters allowed';
73
+					$errors[] = 'Database schema error: Name of column '.$column->name.' on table '.$table->name.' is too long ('.strlen($tableName).'), max. 30 characters allowed';
74 74
 				}
75 75
 
76 76
 				if ($column->autoincrement) {
77 77
 					if ($hasAutoIncrement) {
78
-						$errors[] = 'Database schema error: Table ' . $table->name . ' has multiple autoincrement columns';
78
+						$errors[] = 'Database schema error: Table '.$table->name.' has multiple autoincrement columns';
79 79
 					}
80 80
 
81 81
 					if (strlen($tableName) > 21) {
82
-						$errors[] = 'Database schema error: Name of table ' . $table->name . ' is too long (' . strlen($tableName) . '), max. 27 characters (21 characters for tables with autoincrement) + *dbprefix* allowed';
82
+						$errors[] = 'Database schema error: Name of table '.$table->name.' is too long ('.strlen($tableName).'), max. 27 characters (21 characters for tables with autoincrement) + *dbprefix* allowed';
83 83
 					}
84 84
 
85 85
 					$hasAutoIncrement = true;
@@ -90,12 +90,12 @@  discard block
 block discarded – undo
90 90
 			foreach ($table->declaration->index as $index) {
91 91
 				$hasPrefix = strpos($index->name, '*dbprefix*');
92 92
 				if ($hasPrefix !== false && $hasPrefix !== 0) {
93
-					$warnings[] = 'Database schema warning: *dbprefix* should only appear at the beginning in name of index ' . $index->name . ' on table ' . $table->name;
93
+					$warnings[] = 'Database schema warning: *dbprefix* should only appear at the beginning in name of index '.$index->name.' on table '.$table->name;
94 94
 				}
95 95
 
96 96
 				$indexName = $hasPrefix === 0 ? substr($index->name, strlen('*dbprefix*')) : $index->name;
97 97
 				if (strlen($indexName) > 27) {
98
-					$errors[] = 'Database schema error: Name of index ' . $index->name . ' on table ' . $table->name . ' is too long (' . strlen($tableName) . '), max. 27 characters + *dbprefix* allowed';
98
+					$errors[] = 'Database schema error: Name of index '.$index->name.' on table '.$table->name.' is too long ('.strlen($tableName).'), max. 27 characters + *dbprefix* allowed';
99 99
 				}
100 100
 			}
101 101
 		}
Please login to merge, or discard this patch.
apps/files_external/templates/settings.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -87,7 +87,7 @@
 block discarded – undo
87 87
 	}
88 88
 ?>
89 89
 
90
-<form data-can-create="<?php echo $canCreateMounts?'true':'false' ?>" id="files_external" class="section" data-encryption-enabled="<?php echo $_['encryptionEnabled']?'true': 'false'; ?>">
90
+<form data-can-create="<?php echo $canCreateMounts ? 'true' : 'false' ?>" id="files_external" class="section" data-encryption-enabled="<?php echo $_['encryptionEnabled'] ? 'true' : 'false'; ?>">
91 91
 	<h2 data-anchor-name="external-storage"><?php p($l->t('External storages')); ?></h2>
92 92
 	<?php if (isset($_['dependencies']) and ($_['dependencies'] !== '') and $canCreateMounts) print_unescaped(''.$_['dependencies'].''); ?>
93 93
 	<table id="externalStorage" class="grid" data-admin='<?php print_unescaped(json_encode($_['visibilityType'] === BackendService::VISIBILITY_ADMIN)); ?>'>
Please login to merge, or discard this patch.
apps/files_external/lib/Lib/Storage/SMB.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 
83 83
 			$this->root = isset($params['root']) ? $params['root'] : '/';
84 84
 			if (!$this->root || $this->root[0] !== '/') {
85
-				$this->root = '/' . $this->root;
85
+				$this->root = '/'.$this->root;
86 86
 			}
87 87
 			if (substr($this->root, -1, 1) !== '/') {
88 88
 				$this->root .= '/';
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 		// FIXME: double slash to keep compatible with the old storage ids,
102 102
 		// failure to do so will lead to creation of a new storage id and
103 103
 		// loss of shares from the storage
104
-		return 'smb::' . $this->server->getUser() . '@' . $this->server->getHost() . '//' . $this->share->getName() . '/' . $this->root;
104
+		return 'smb::'.$this->server->getUser().'@'.$this->server->getHost().'//'.$this->share->getName().'/'.$this->root;
105 105
 	}
106 106
 
107 107
 	/**
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 	 * @return string
110 110
 	 */
111 111
 	protected function buildPath($path) {
112
-		return Filesystem::normalizePath($this->root . '/' . $path, true, false, true);
112
+		return Filesystem::normalizePath($this->root.'/'.$path, true, false, true);
113 113
 	}
114 114
 
115 115
 	protected function relativePath($fullPath) {
@@ -149,9 +149,9 @@  discard block
 block discarded – undo
149 149
 			$path = $this->buildPath($path);
150 150
 			$files = $this->share->dir($path);
151 151
 			foreach ($files as $file) {
152
-				$this->statCache[$path . '/' . $file->getName()] = $file;
152
+				$this->statCache[$path.'/'.$file->getName()] = $file;
153 153
 			}
154
-			return array_filter($files, function (IFileInfo $file) {
154
+			return array_filter($files, function(IFileInfo $file) {
155 155
 				return !$file->isHidden();
156 156
 			});
157 157
 		} catch (ConnectException $e) {
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
 				case 'w':
313 313
 				case 'wb':
314 314
 					$source = $this->share->write($fullPath);
315
-					return CallBackWrapper::wrap($source, null, null, function () use ($fullPath) {
315
+					return CallBackWrapper::wrap($source, null, null, function() use ($fullPath) {
316 316
 						unset($this->statCache[$fullPath]);
317 317
 					});
318 318
 				case 'a':
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
 					}
345 345
 					$source = fopen($tmpFile, $mode);
346 346
 					$share = $this->share;
347
-					return CallbackWrapper::wrap($source, null, null, function () use ($tmpFile, $fullPath, $share) {
347
+					return CallbackWrapper::wrap($source, null, null, function() use ($tmpFile, $fullPath, $share) {
348 348
 						unset($this->statCache[$fullPath]);
349 349
 						$share->put($tmpFile, $fullPath);
350 350
 						unlink($tmpFile);
@@ -370,7 +370,7 @@  discard block
 block discarded – undo
370 370
 			$content = $this->share->dir($this->buildPath($path));
371 371
 			foreach ($content as $file) {
372 372
 				if ($file->isDirectory()) {
373
-					$this->rmdir($path . '/' . $file->getName());
373
+					$this->rmdir($path.'/'.$file->getName());
374 374
 				} else {
375 375
 					$this->share->del($file->getPath());
376 376
 				}
@@ -407,7 +407,7 @@  discard block
 block discarded – undo
407 407
 		} catch (ForbiddenException $e) {
408 408
 			return false;
409 409
 		}
410
-		$names = array_map(function ($info) {
410
+		$names = array_map(function($info) {
411 411
 			/** @var \Icewind\SMB\IFileInfo $info */
412 412
 			return $info->getName();
413 413
 		}, $files);
@@ -489,7 +489,7 @@  discard block
 block discarded – undo
489 489
 	 */
490 490
 	public static function checkDependencies() {
491 491
 		return (
492
-			(bool)\OC_Helper::findBinaryPath('smbclient')
492
+			(bool) \OC_Helper::findBinaryPath('smbclient')
493 493
 			|| Server::NativeAvailable()
494 494
 		) ? true : ['smbclient'];
495 495
 	}
@@ -508,7 +508,7 @@  discard block
 block discarded – undo
508 508
 	}
509 509
 
510 510
 	public function listen($path, callable $callback) {
511
-		$this->notify($path)->listen(function (IChange $change) use ($callback) {
511
+		$this->notify($path)->listen(function(IChange $change) use ($callback) {
512 512
 			if ($change instanceof IRenameChange) {
513 513
 				return $callback($change->getType(), $change->getPath(), $change->getTargetPath());
514 514
 			} else {
@@ -518,7 +518,7 @@  discard block
 block discarded – undo
518 518
 	}
519 519
 
520 520
 	public function notify($path) {
521
-		$path = '/' . ltrim($path, '/');
521
+		$path = '/'.ltrim($path, '/');
522 522
 		$shareNotifyHandler = $this->share->notify($this->buildPath($path));
523 523
 		return new SMBNotifyHandler($shareNotifyHandler, $this->root);
524 524
 	}
Please login to merge, or discard this patch.