Completed
Pull Request — master (#3643)
by Christoph
12:28
created
lib/private/DB/MDB2SchemaReader.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 					$this->loadTable($schema, $child);
100 100
 					break;
101 101
 				default:
102
-					throw new \DomainException('Unknown element: ' . $child->getName());
102
+					throw new \DomainException('Unknown element: '.$child->getName());
103 103
 
104 104
 			}
105 105
 		}
@@ -119,13 +119,13 @@  discard block
 block discarded – undo
119 119
 			 */
120 120
 			switch ($child->getName()) {
121 121
 				case 'name':
122
-					$name = (string)$child;
122
+					$name = (string) $child;
123 123
 					$name = str_replace('*dbprefix*', $this->DBTABLEPREFIX, $name);
124 124
 					$name = $this->platform->quoteIdentifier($name);
125 125
 					$table = $schema->createTable($name);
126 126
 					$table->setSchemaConfig($this->schemaConfig);
127 127
 
128
-					if($this->platform instanceof MySqlPlatform && $this->config->getSystemValue('mysql.utf8mb4', false)) {
128
+					if ($this->platform instanceof MySqlPlatform && $this->config->getSystemValue('mysql.utf8mb4', false)) {
129 129
 						$table->addOption('charset', 'utf8mb4');
130 130
 						$table->addOption('collate', 'utf8mb4_bin');
131 131
 						$table->addOption('row_format', 'compressed');
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 					$this->loadDeclaration($table, $child);
145 145
 					break;
146 146
 				default:
147
-					throw new \DomainException('Unknown element: ' . $child->getName());
147
+					throw new \DomainException('Unknown element: '.$child->getName());
148 148
 
149 149
 			}
150 150
 		}
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 					$this->loadIndex($table, $child);
169 169
 					break;
170 170
 				default:
171
-					throw new \DomainException('Unknown element: ' . $child->getName());
171
+					throw new \DomainException('Unknown element: '.$child->getName());
172 172
 
173 173
 			}
174 174
 		}
@@ -180,18 +180,18 @@  discard block
 block discarded – undo
180 180
 	 * @throws \DomainException
181 181
 	 */
182 182
 	private function loadField($table, $xml) {
183
-		$options = array( 'notnull' => false );
183
+		$options = array('notnull' => false);
184 184
 		foreach ($xml->children() as $child) {
185 185
 			/**
186 186
 			 * @var \SimpleXMLElement $child
187 187
 			 */
188 188
 			switch ($child->getName()) {
189 189
 				case 'name':
190
-					$name = (string)$child;
190
+					$name = (string) $child;
191 191
 					$name = $this->platform->quoteIdentifier($name);
192 192
 					break;
193 193
 				case 'type':
194
-					$type = (string)$child;
194
+					$type = (string) $child;
195 195
 					switch ($type) {
196 196
 						case 'text':
197 197
 							$type = 'string';
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 					}
209 209
 					break;
210 210
 				case 'length':
211
-					$length = (string)$child;
211
+					$length = (string) $child;
212 212
 					$options['length'] = $length;
213 213
 					break;
214 214
 				case 'unsigned':
@@ -224,11 +224,11 @@  discard block
 block discarded – undo
224 224
 					$options['autoincrement'] = $autoincrement;
225 225
 					break;
226 226
 				case 'default':
227
-					$default = (string)$child;
227
+					$default = (string) $child;
228 228
 					$options['default'] = $default;
229 229
 					break;
230 230
 				case 'comments':
231
-					$comment = (string)$child;
231
+					$comment = (string) $child;
232 232
 					$options['comment'] = $comment;
233 233
 					break;
234 234
 				case 'primary':
@@ -236,15 +236,15 @@  discard block
 block discarded – undo
236 236
 					$options['primary'] = $primary;
237 237
 					break;
238 238
 				case 'precision':
239
-					$precision = (string)$child;
239
+					$precision = (string) $child;
240 240
 					$options['precision'] = $precision;
241 241
 					break;
242 242
 				case 'scale':
243
-					$scale = (string)$child;
243
+					$scale = (string) $child;
244 244
 					$options['scale'] = $scale;
245 245
 					break;
246 246
 				default:
247
-					throw new \DomainException('Unknown element: ' . $child->getName());
247
+					throw new \DomainException('Unknown element: '.$child->getName());
248 248
 
249 249
 			}
250 250
 		}
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
 				}
267 267
 			}
268 268
 			if ($type === 'integer' && isset($options['default'])) {
269
-				$options['default'] = (int)$options['default'];
269
+				$options['default'] = (int) $options['default'];
270 270
 			}
271 271
 			if ($type === 'integer' && isset($options['length'])) {
272 272
 				$length = $options['length'];
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
 			 */
306 306
 			switch ($child->getName()) {
307 307
 				case 'name':
308
-					$name = (string)$child;
308
+					$name = (string) $child;
309 309
 					break;
310 310
 				case 'primary':
311 311
 					$primary = $this->asBool($child);
@@ -320,20 +320,20 @@  discard block
 block discarded – undo
320 320
 						 */
321 321
 						switch ($field->getName()) {
322 322
 							case 'name':
323
-								$field_name = (string)$field;
323
+								$field_name = (string) $field;
324 324
 								$field_name = $this->platform->quoteIdentifier($field_name);
325 325
 								$fields[] = $field_name;
326 326
 								break;
327 327
 							case 'sorting':
328 328
 								break;
329 329
 							default:
330
-								throw new \DomainException('Unknown element: ' . $field->getName());
330
+								throw new \DomainException('Unknown element: '.$field->getName());
331 331
 
332 332
 						}
333 333
 					}
334 334
 					break;
335 335
 				default:
336
-					throw new \DomainException('Unknown element: ' . $child->getName());
336
+					throw new \DomainException('Unknown element: '.$child->getName());
337 337
 
338 338
 			}
339 339
 		}
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
 				}
352 352
 			}
353 353
 		} else {
354
-			throw new \DomainException('Empty index definition: ' . $name . ' options:' . print_r($fields, true));
354
+			throw new \DomainException('Empty index definition: '.$name.' options:'.print_r($fields, true));
355 355
 		}
356 356
 	}
357 357
 
@@ -360,13 +360,13 @@  discard block
 block discarded – undo
360 360
 	 * @return bool
361 361
 	 */
362 362
 	private function asBool($xml) {
363
-		$result = (string)$xml;
363
+		$result = (string) $xml;
364 364
 		if ($result == 'true') {
365 365
 			$result = true;
366 366
 		} elseif ($result == 'false') {
367 367
 			$result = false;
368 368
 		}
369
-		return (bool)$result;
369
+		return (bool) $result;
370 370
 	}
371 371
 
372 372
 }
Please login to merge, or discard this patch.
lib/private/DB/MDB2SchemaWriter.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 		$xml->addChild('name', $config->getSystemValue('dbname', 'owncloud'));
44 44
 		$xml->addChild('create', 'true');
45 45
 		$xml->addChild('overwrite', 'false');
46
-		if($config->getSystemValue('dbtype', 'sqlite') === 'mysql' && $config->getSystemValue('mysql.utf8mb4', false)) {
46
+		if ($config->getSystemValue('dbtype', 'sqlite') === 'mysql' && $config->getSystemValue('mysql.utf8mb4', false)) {
47 47
 			$xml->addChild('charset', 'utf8mb4');
48 48
 		} else {
49 49
 			$xml->addChild('charset', 'utf8');
@@ -51,9 +51,9 @@  discard block
 block discarded – undo
51 51
 
52 52
 		// FIX ME: bloody work around
53 53
 		if ($config->getSystemValue('dbtype', 'sqlite') === 'oci') {
54
-			$filterExpression = '/^"' . preg_quote($conn->getPrefix()) . '/';
54
+			$filterExpression = '/^"'.preg_quote($conn->getPrefix()).'/';
55 55
 		} else {
56
-			$filterExpression = '/^' . preg_quote($conn->getPrefix()) . '/';
56
+			$filterExpression = '/^'.preg_quote($conn->getPrefix()).'/';
57 57
 		}
58 58
 		$conn->getConfiguration()->setFilterSchemaAssetsExpression($filterExpression);
59 59
 
@@ -71,13 +71,13 @@  discard block
 block discarded – undo
71 71
 	private static function saveTable($table, $xml) {
72 72
 		$xml->addChild('name', $table->getName());
73 73
 		$declaration = $xml->addChild('declaration');
74
-		foreach($table->getColumns() as $column) {
74
+		foreach ($table->getColumns() as $column) {
75 75
 			self::saveColumn($column, $declaration->addChild('field'));
76 76
 		}
77
-		foreach($table->getIndexes() as $index) {
77
+		foreach ($table->getIndexes() as $index) {
78 78
 			if ($index->getName() == 'PRIMARY') {
79 79
 				$autoincrement = false;
80
-				foreach($index->getColumns() as $column) {
80
+				foreach ($index->getColumns() as $column) {
81 81
 					if ($table->getColumn($column)->getAutoincrement()) {
82 82
 						$autoincrement = true;
83 83
 					}
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 	 */
97 97
 	private static function saveColumn($column, $xml) {
98 98
 		$xml->addChild('name', $column->getName());
99
-		switch($column->getType()) {
99
+		switch ($column->getType()) {
100 100
 			case 'SmallInt':
101 101
 			case 'Integer':
102 102
 			case 'BigInt':
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
 		elseif ($index->isUnique()) {
170 170
 			$xml->addChild('unique', 'true');
171 171
 		}
172
-		foreach($index->getColumns() as $column) {
172
+		foreach ($index->getColumns() as $column) {
173 173
 			$field = $xml->addChild('field');
174 174
 			$field->addChild('name', $column);
175 175
 			$field->addChild('sorting', 'ascending');
Please login to merge, or discard this patch.
lib/private/DB/OracleMigrator.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 				// auto increment is not relevant for oracle and can anyhow not be applied on change
45 45
 				$column->changedProperties = array_diff($column->changedProperties, ['autoincrement', 'unsigned']);
46 46
 			}
47
-			$tableDiff->changedColumns = array_filter($tableDiff->changedColumns, function (ColumnDiff $column) {
47
+			$tableDiff->changedColumns = array_filter($tableDiff->changedColumns, function(ColumnDiff $column) {
48 48
 				return count($column->changedProperties) > 0;
49 49
 			});
50 50
 		}
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 	 * @return string
58 58
 	 */
59 59
 	protected function generateTemporaryTableName($name) {
60
-		return 'oc_' . uniqid();
60
+		return 'oc_'.uniqid();
61 61
 	}
62 62
 
63 63
 	/**
@@ -66,16 +66,16 @@  discard block
 block discarded – undo
66 66
 	 */
67 67
 	protected function convertStatementToScript($statement) {
68 68
 		if (substr($statement, -1) === ';') {
69
-			return $statement . PHP_EOL . '/' . PHP_EOL;
69
+			return $statement.PHP_EOL.'/'.PHP_EOL;
70 70
 		}
71
-		$script = $statement . ';';
71
+		$script = $statement.';';
72 72
 		$script .= PHP_EOL;
73 73
 		$script .= PHP_EOL;
74 74
 		return $script;
75 75
 	}
76 76
 
77 77
 	protected function getFilterExpression() {
78
-		return '/^"' . preg_quote($this->config->getSystemValue('dbtableprefix', 'oc_')) . '/';
78
+		return '/^"'.preg_quote($this->config->getSystemValue('dbtableprefix', 'oc_')).'/';
79 79
 	}
80 80
 
81 81
 }
Please login to merge, or discard this patch.
lib/private/DB/Migrator.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 	 * @return string
138 138
 	 */
139 139
 	protected function generateTemporaryTableName($name) {
140
-		return $this->config->getSystemValue('dbtableprefix', 'oc_') . $name . '_' . $this->random->generate(13, ISecureRandom::CHAR_LOWER . ISecureRandom::CHAR_DIGITS);
140
+		return $this->config->getSystemValue('dbtableprefix', 'oc_').$name.'_'.$this->random->generate(13, ISecureRandom::CHAR_LOWER.ISecureRandom::CHAR_DIGITS);
141 141
 	}
142 142
 
143 143
 	/**
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 				$indexName = $index->getName();
189 189
 			} else {
190 190
 				// avoid conflicts in index names
191
-				$indexName = $this->config->getSystemValue('dbtableprefix', 'oc_') . $this->random->generate(13, ISecureRandom::CHAR_LOWER);
191
+				$indexName = $this->config->getSystemValue('dbtableprefix', 'oc_').$this->random->generate(13, ISecureRandom::CHAR_LOWER);
192 192
 			}
193 193
 			$newIndexes[] = new Index($indexName, $index->getColumns(), $index->isUnique(), $index->isPrimary());
194 194
 		}
@@ -268,15 +268,15 @@  discard block
 block discarded – undo
268 268
 		$quotedSource = $this->connection->quoteIdentifier($sourceName);
269 269
 		$quotedTarget = $this->connection->quoteIdentifier($targetName);
270 270
 
271
-		$this->connection->exec('CREATE TABLE ' . $quotedTarget . ' (LIKE ' . $quotedSource . ')');
272
-		$this->connection->exec('INSERT INTO ' . $quotedTarget . ' SELECT * FROM ' . $quotedSource);
271
+		$this->connection->exec('CREATE TABLE '.$quotedTarget.' (LIKE '.$quotedSource.')');
272
+		$this->connection->exec('INSERT INTO '.$quotedTarget.' SELECT * FROM '.$quotedSource);
273 273
 	}
274 274
 
275 275
 	/**
276 276
 	 * @param string $name
277 277
 	 */
278 278
 	protected function dropTable($name) {
279
-		$this->connection->exec('DROP TABLE ' . $this->connection->quoteIdentifier($name));
279
+		$this->connection->exec('DROP TABLE '.$this->connection->quoteIdentifier($name));
280 280
 	}
281 281
 
282 282
 	/**
@@ -284,30 +284,30 @@  discard block
 block discarded – undo
284 284
 	 * @return string
285 285
 	 */
286 286
 	protected function convertStatementToScript($statement) {
287
-		$script = $statement . ';';
287
+		$script = $statement.';';
288 288
 		$script .= PHP_EOL;
289 289
 		$script .= PHP_EOL;
290 290
 		return $script;
291 291
 	}
292 292
 
293 293
 	protected function getFilterExpression() {
294
-		return '/^' . preg_quote($this->config->getSystemValue('dbtableprefix', 'oc_')) . '/';
294
+		return '/^'.preg_quote($this->config->getSystemValue('dbtableprefix', 'oc_')).'/';
295 295
 	}
296 296
 
297 297
 	protected function emit($sql, $step, $max) {
298 298
 		if ($this->noEmit) {
299 299
 			return;
300 300
 		}
301
-		if(is_null($this->dispatcher)) {
301
+		if (is_null($this->dispatcher)) {
302 302
 			return;
303 303
 		}
304
-		$this->dispatcher->dispatch('\OC\DB\Migrator::executeSql', new GenericEvent($sql, [$step+1, $max]));
304
+		$this->dispatcher->dispatch('\OC\DB\Migrator::executeSql', new GenericEvent($sql, [$step + 1, $max]));
305 305
 	}
306 306
 
307 307
 	private function emitCheckStep($tableName, $step, $max) {
308
-		if(is_null($this->dispatcher)) {
308
+		if (is_null($this->dispatcher)) {
309 309
 			return;
310 310
 		}
311
-		$this->dispatcher->dispatch('\OC\DB\Migrator::checkTable', new GenericEvent($tableName, [$step+1, $max]));
311
+		$this->dispatcher->dispatch('\OC\DB\Migrator::checkTable', new GenericEvent($tableName, [$step + 1, $max]));
312 312
 	}
313 313
 }
Please login to merge, or discard this patch.
lib/private/DB/SQLiteMigrator.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@
 block discarded – undo
63 63
 	 * @return string
64 64
 	 */
65 65
 	private function buildTempDatabase() {
66
-		$dataDir = $this->config->getSystemValue("datadirectory", \OC::$SERVERROOT . '/data');
66
+		$dataDir = $this->config->getSystemValue("datadirectory", \OC::$SERVERROOT.'/data');
67 67
 		$tmpFile = uniqid("oc_");
68 68
 		return "$dataDir/$tmpFile.db";
69 69
 	}
Please login to merge, or discard this patch.
lib/private/DB/AdapterPgSql.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -31,8 +31,8 @@
 block discarded – undo
31 31
 
32 32
 	const UNIX_TIMESTAMP_REPLACEMENT = 'cast(extract(epoch from current_timestamp) as integer)';
33 33
 	public function fixupStatement($statement) {
34
-		$statement = str_replace( '`', '"', $statement );
35
-		$statement = str_ireplace( 'UNIX_TIMESTAMP()', self::UNIX_TIMESTAMP_REPLACEMENT, $statement );
34
+		$statement = str_replace('`', '"', $statement);
35
+		$statement = str_ireplace('UNIX_TIMESTAMP()', self::UNIX_TIMESTAMP_REPLACEMENT, $statement);
36 36
 		return $statement;
37 37
 	}
38 38
 }
Please login to merge, or discard this patch.
lib/private/DB/ConnectionFactory.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 	);
67 67
 
68 68
 	public function __construct(IConfig $config) {
69
-		if($config->getSystemValue('mysql.utf8mb4', false)) {
69
+		if ($config->getSystemValue('mysql.utf8mb4', false)) {
70 70
 			$this->defaultConnectionParams['mysql']['charset'] = 'utf8mb4';
71 71
 		}
72 72
 	}
@@ -167,8 +167,8 @@  discard block
 block discarded – undo
167 167
 		$name = $config->getValue('dbname', 'owncloud');
168 168
 
169 169
 		if ($this->normalizeType($type) === 'sqlite3') {
170
-			$dataDir = $config->getValue("datadirectory", \OC::$SERVERROOT . '/data');
171
-			$connectionParams['path'] = $dataDir . '/' . $name . '.db';
170
+			$dataDir = $config->getValue("datadirectory", \OC::$SERVERROOT.'/data');
171
+			$connectionParams['path'] = $dataDir.'/'.$name.'.db';
172 172
 		} else {
173 173
 			$host = $config->getValue('dbhost', '');
174 174
 			if (strpos($host, ':')) {
Please login to merge, or discard this patch.
lib/private/App/AppStore/Fetcher/AppFetcher.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -70,13 +70,13 @@  discard block
 block discarded – undo
70 70
 
71 71
 		$ncVersion = $this->config->getSystemValue('version');
72 72
 		$ncMajorVersion = explode('.', $ncVersion)[0];
73
-		foreach($response['data'] as $dataKey => $app) {
73
+		foreach ($response['data'] as $dataKey => $app) {
74 74
 			$releases = [];
75 75
 
76 76
 			// Filter all compatible releases
77
-			foreach($app['releases'] as $release) {
77
+			foreach ($app['releases'] as $release) {
78 78
 				// Exclude all nightly and pre-releases
79
-				if($release['isNightly'] === false
79
+				if ($release['isNightly'] === false
80 80
 					&& strpos($release['version'], '-') === false) {
81 81
 					// Exclude all versions not compatible with the current version
82 82
 					$versionParser = new VersionParser();
@@ -94,23 +94,23 @@  discard block
 block discarded – undo
94 94
 
95 95
 			// Get the highest version
96 96
 			$versions = [];
97
-			foreach($releases as $release) {
97
+			foreach ($releases as $release) {
98 98
 				$versions[] = $release['version'];
99 99
 			}
100 100
 			usort($versions, 'version_compare');
101 101
 			$versions = array_reverse($versions);
102 102
 			$compatible = false;
103
-			if(isset($versions[0])) {
103
+			if (isset($versions[0])) {
104 104
 				$highestVersion = $versions[0];
105 105
 				foreach ($releases as $release) {
106
-					if ((string)$release['version'] === (string)$highestVersion) {
106
+					if ((string) $release['version'] === (string) $highestVersion) {
107 107
 						$compatible = true;
108 108
 						$response['data'][$dataKey]['releases'] = [$release];
109 109
 						break;
110 110
 					}
111 111
 				}
112 112
 			}
113
-			if(!$compatible) {
113
+			if (!$compatible) {
114 114
 				unset($response['data'][$dataKey]);
115 115
 			}
116 116
 		}
Please login to merge, or discard this patch.
lib/private/App/AppStore/Version/VersionParser.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 	 * @return bool
33 33
 	 */
34 34
 	private function isValidVersionString($versionString) {
35
-		return (bool)preg_match('/^[0-9.]+$/', $versionString);
35
+		return (bool) preg_match('/^[0-9.]+$/', $versionString);
36 36
 	}
37 37
 
38 38
 	/**
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 	 */
45 45
 	public function getVersion($versionSpec) {
46 46
 		// * indicates that the version is compatible with all versions
47
-		if($versionSpec === '*') {
47
+		if ($versionSpec === '*') {
48 48
 			return new Version('', '');
49 49
 		}
50 50
 
@@ -56,18 +56,18 @@  discard block
 block discarded – undo
56 56
 		$secondVersion = isset($versionElements[1]) ? $versionElements[1] : '';
57 57
 		$secondVersionNumber = substr($secondVersion, 2);
58 58
 
59
-		switch(count($versionElements)) {
59
+		switch (count($versionElements)) {
60 60
 			case 1:
61
-				if(!$this->isValidVersionString($firstVersionNumber)) {
61
+				if (!$this->isValidVersionString($firstVersionNumber)) {
62 62
 					break;
63 63
 				}
64
-				if(substr($firstVersion, 0, 1) === '>') {
64
+				if (substr($firstVersion, 0, 1) === '>') {
65 65
 					return new Version($firstVersionNumber, '');
66 66
 				} else {
67 67
 					return new Version('', $firstVersionNumber);
68 68
 				}
69 69
 			case 2:
70
-				if(!$this->isValidVersionString($firstVersionNumber) || !$this->isValidVersionString($secondVersionNumber)) {
70
+				if (!$this->isValidVersionString($firstVersionNumber) || !$this->isValidVersionString($secondVersionNumber)) {
71 71
 					break;
72 72
 				}
73 73
 				return new Version($firstVersionNumber, $secondVersionNumber);
Please login to merge, or discard this patch.