@@ -50,7 +50,7 @@ |
||
50 | 50 | public function __construct($arguments) { |
51 | 51 | $this->user = $arguments['user']; |
52 | 52 | $datadir = $this->user->getHome(); |
53 | - $this->id = 'home::' . $this->user->getUID(); |
|
53 | + $this->id = 'home::'.$this->user->getUID(); |
|
54 | 54 | |
55 | 55 | parent::__construct(['datadir' => $datadir]); |
56 | 56 | } |
@@ -49,7 +49,7 @@ |
||
49 | 49 | public function getDirectoryListing() { |
50 | 50 | $listing = $this->folder->getDirectoryListing(); |
51 | 51 | |
52 | - $fileListing = array_map(function (Node $file) { |
|
52 | + $fileListing = array_map(function(Node $file) { |
|
53 | 53 | if ($file instanceof File) { |
54 | 54 | return new SimpleFile($file); |
55 | 55 | } |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | * @param array $params |
34 | 34 | */ |
35 | 35 | public function __construct($params) { |
36 | - if (! isset($params['user']) || ! $params['user'] instanceof User) { |
|
36 | + if (!isset($params['user']) || !$params['user'] instanceof User) { |
|
37 | 37 | throw new \Exception('missing user object in parameters'); |
38 | 38 | } |
39 | 39 | $this->user = $params['user']; |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | } |
42 | 42 | |
43 | 43 | public function getId() { |
44 | - return 'object::user:' . $this->user->getUID(); |
|
44 | + return 'object::user:'.$this->user->getUID(); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | /** |
@@ -49,7 +49,7 @@ |
||
49 | 49 | * @return null |
50 | 50 | */ |
51 | 51 | public function resynchronizeDatabaseSequences(Connection $conn) { |
52 | - $filterExpression = '/^' . preg_quote($this->config->getSystemValue('dbtableprefix', 'oc_')) . '/'; |
|
52 | + $filterExpression = '/^'.preg_quote($this->config->getSystemValue('dbtableprefix', 'oc_')).'/'; |
|
53 | 53 | $databaseName = $conn->getDatabase(); |
54 | 54 | $conn->getConfiguration()->setFilterSchemaAssetsExpression($filterExpression); |
55 | 55 |
@@ -64,14 +64,14 @@ |
||
64 | 64 | if (empty($compare)) { |
65 | 65 | $compare = array_keys($input); |
66 | 66 | } |
67 | - $fieldList = '`' . implode('`,`', array_keys($input)) . '`'; |
|
67 | + $fieldList = '`'.implode('`,`', array_keys($input)).'`'; |
|
68 | 68 | $query = "INSERT INTO `$table` ($fieldList) SELECT " |
69 | 69 | . str_repeat('?,', count($input) - 1).'? ' |
70 | 70 | . " WHERE NOT EXISTS (SELECT 1 FROM `$table` WHERE "; |
71 | 71 | |
72 | 72 | $inserts = array_values($input); |
73 | 73 | foreach ($compare as $key) { |
74 | - $query .= '`' . $key . '`'; |
|
74 | + $query .= '`'.$key.'`'; |
|
75 | 75 | if (is_null($input[$key])) { |
76 | 76 | $query .= ' IS NULL AND '; |
77 | 77 | } else { |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | $this->loadTable($schema, $child); |
85 | 85 | break; |
86 | 86 | default: |
87 | - throw new \DomainException('Unknown element: ' . $child->getName()); |
|
87 | + throw new \DomainException('Unknown element: '.$child->getName()); |
|
88 | 88 | |
89 | 89 | } |
90 | 90 | } |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | */ |
105 | 105 | switch ($child->getName()) { |
106 | 106 | case 'name': |
107 | - $name = (string)$child; |
|
107 | + $name = (string) $child; |
|
108 | 108 | $name = str_replace('*dbprefix*', $this->DBTABLEPREFIX, $name); |
109 | 109 | $name = $this->platform->quoteIdentifier($name); |
110 | 110 | $table = $schema->createTable($name); |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | $this->loadDeclaration($table, $child); |
121 | 121 | break; |
122 | 122 | default: |
123 | - throw new \DomainException('Unknown element: ' . $child->getName()); |
|
123 | + throw new \DomainException('Unknown element: '.$child->getName()); |
|
124 | 124 | |
125 | 125 | } |
126 | 126 | } |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | $this->loadIndex($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 | } |
@@ -156,18 +156,18 @@ discard block |
||
156 | 156 | * @throws \DomainException |
157 | 157 | */ |
158 | 158 | private function loadField($table, $xml) { |
159 | - $options = [ 'notnull' => false ]; |
|
159 | + $options = ['notnull' => false]; |
|
160 | 160 | foreach ($xml->children() as $child) { |
161 | 161 | /** |
162 | 162 | * @var \SimpleXMLElement $child |
163 | 163 | */ |
164 | 164 | switch ($child->getName()) { |
165 | 165 | case 'name': |
166 | - $name = (string)$child; |
|
166 | + $name = (string) $child; |
|
167 | 167 | $name = $this->platform->quoteIdentifier($name); |
168 | 168 | break; |
169 | 169 | case 'type': |
170 | - $type = (string)$child; |
|
170 | + $type = (string) $child; |
|
171 | 171 | switch ($type) { |
172 | 172 | case 'text': |
173 | 173 | $type = 'string'; |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | } |
185 | 185 | break; |
186 | 186 | case 'length': |
187 | - $length = (string)$child; |
|
187 | + $length = (string) $child; |
|
188 | 188 | $options['length'] = $length; |
189 | 189 | break; |
190 | 190 | case 'unsigned': |
@@ -200,11 +200,11 @@ discard block |
||
200 | 200 | $options['autoincrement'] = $autoincrement; |
201 | 201 | break; |
202 | 202 | case 'default': |
203 | - $default = (string)$child; |
|
203 | + $default = (string) $child; |
|
204 | 204 | $options['default'] = $default; |
205 | 205 | break; |
206 | 206 | case 'comments': |
207 | - $comment = (string)$child; |
|
207 | + $comment = (string) $child; |
|
208 | 208 | $options['comment'] = $comment; |
209 | 209 | break; |
210 | 210 | case 'primary': |
@@ -212,15 +212,15 @@ discard block |
||
212 | 212 | $options['primary'] = $primary; |
213 | 213 | break; |
214 | 214 | case 'precision': |
215 | - $precision = (string)$child; |
|
215 | + $precision = (string) $child; |
|
216 | 216 | $options['precision'] = $precision; |
217 | 217 | break; |
218 | 218 | case 'scale': |
219 | - $scale = (string)$child; |
|
219 | + $scale = (string) $child; |
|
220 | 220 | $options['scale'] = $scale; |
221 | 221 | break; |
222 | 222 | default: |
223 | - throw new \DomainException('Unknown element: ' . $child->getName()); |
|
223 | + throw new \DomainException('Unknown element: '.$child->getName()); |
|
224 | 224 | |
225 | 225 | } |
226 | 226 | } |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | } |
243 | 243 | } |
244 | 244 | if ($type === 'integer' && isset($options['default'])) { |
245 | - $options['default'] = (int)$options['default']; |
|
245 | + $options['default'] = (int) $options['default']; |
|
246 | 246 | } |
247 | 247 | if ($type === 'integer' && isset($options['length'])) { |
248 | 248 | $length = $options['length']; |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | */ |
283 | 283 | switch ($child->getName()) { |
284 | 284 | case 'name': |
285 | - $name = (string)$child; |
|
285 | + $name = (string) $child; |
|
286 | 286 | break; |
287 | 287 | case 'primary': |
288 | 288 | $primary = $this->asBool($child); |
@@ -297,20 +297,20 @@ discard block |
||
297 | 297 | */ |
298 | 298 | switch ($field->getName()) { |
299 | 299 | case 'name': |
300 | - $field_name = (string)$field; |
|
300 | + $field_name = (string) $field; |
|
301 | 301 | $field_name = $this->platform->quoteIdentifier($field_name); |
302 | 302 | $fields[] = $field_name; |
303 | 303 | break; |
304 | 304 | case 'sorting': |
305 | 305 | break; |
306 | 306 | default: |
307 | - throw new \DomainException('Unknown element: ' . $field->getName()); |
|
307 | + throw new \DomainException('Unknown element: '.$field->getName()); |
|
308 | 308 | |
309 | 309 | } |
310 | 310 | } |
311 | 311 | break; |
312 | 312 | default: |
313 | - throw new \DomainException('Unknown element: ' . $child->getName()); |
|
313 | + throw new \DomainException('Unknown element: '.$child->getName()); |
|
314 | 314 | |
315 | 315 | } |
316 | 316 | } |
@@ -328,7 +328,7 @@ discard block |
||
328 | 328 | } |
329 | 329 | } |
330 | 330 | } else { |
331 | - throw new \DomainException('Empty index definition: ' . $name . ' options:' . print_r($fields, true)); |
|
331 | + throw new \DomainException('Empty index definition: '.$name.' options:'.print_r($fields, true)); |
|
332 | 332 | } |
333 | 333 | } |
334 | 334 | |
@@ -337,12 +337,12 @@ discard block |
||
337 | 337 | * @return bool |
338 | 338 | */ |
339 | 339 | private function asBool($xml) { |
340 | - $result = (string)$xml; |
|
340 | + $result = (string) $xml; |
|
341 | 341 | if ($result == 'true') { |
342 | 342 | $result = true; |
343 | 343 | } elseif ($result == 'false') { |
344 | 344 | $result = false; |
345 | 345 | } |
346 | - return (bool)$result; |
|
346 | + return (bool) $result; |
|
347 | 347 | } |
348 | 348 | } |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | * @param string $table table name without the prefix |
83 | 83 | */ |
84 | 84 | public function dropTable($table) { |
85 | - $table = $this->tablePrefix . trim($table); |
|
85 | + $table = $this->tablePrefix.trim($table); |
|
86 | 86 | $table = $this->quoteIdentifier($table); |
87 | 87 | $schema = $this->getSchemaManager(); |
88 | 88 | if ($schema->tablesExist([$table])) { |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | * @return bool |
98 | 98 | */ |
99 | 99 | public function tableExists($table) { |
100 | - $table = $this->tablePrefix . trim($table); |
|
100 | + $table = $this->tablePrefix.trim($table); |
|
101 | 101 | $table = $this->quoteIdentifier($table); |
102 | 102 | $schema = $this->getSchemaManager(); |
103 | 103 | return $schema->tablesExist([$table]); |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | return parent::connect(); |
60 | 60 | } catch (DBALException $e) { |
61 | 61 | // throw a new exception to prevent leaking info from the stacktrace |
62 | - throw new DBALException('Failed to connect to the database: ' . $e->getMessage(), $e->getCode()); |
|
62 | + throw new DBALException('Failed to connect to the database: '.$e->getMessage(), $e->getCode()); |
|
63 | 63 | } |
64 | 64 | } |
65 | 65 | |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | // 0 is the method where we use `getCallerBacktrace` |
112 | 112 | // 1 is the target method which uses the method we want to log |
113 | 113 | if (isset($traces[1])) { |
114 | - return $traces[1]['file'] . ':' . $traces[1]['line']; |
|
114 | + return $traces[1]['file'].':'.$traces[1]['line']; |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | return ''; |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | $insertQb = $this->getQueryBuilder(); |
281 | 281 | $insertQb->insert($table) |
282 | 282 | ->values( |
283 | - array_map(function ($value) use ($insertQb) { |
|
283 | + array_map(function($value) use ($insertQb) { |
|
284 | 284 | return $insertQb->createNamedParameter($value, $this->getType($value)); |
285 | 285 | }, array_merge($keys, $values)) |
286 | 286 | ); |
@@ -324,7 +324,7 @@ discard block |
||
324 | 324 | throw new \BadMethodCallException('Can not lock a new table until the previous lock is released.'); |
325 | 325 | } |
326 | 326 | |
327 | - $tableName = $this->tablePrefix . $tableName; |
|
327 | + $tableName = $this->tablePrefix.$tableName; |
|
328 | 328 | $this->lockedTable = $tableName; |
329 | 329 | $this->adapter->lockTable($tableName); |
330 | 330 | } |
@@ -345,11 +345,11 @@ discard block |
||
345 | 345 | * @return string |
346 | 346 | */ |
347 | 347 | public function getError() { |
348 | - $msg = $this->errorCode() . ': '; |
|
348 | + $msg = $this->errorCode().': '; |
|
349 | 349 | $errorInfo = $this->errorInfo(); |
350 | 350 | if (is_array($errorInfo)) { |
351 | - $msg .= 'SQLSTATE = '.$errorInfo[0] . ', '; |
|
352 | - $msg .= 'Driver Code = '.$errorInfo[1] . ', '; |
|
351 | + $msg .= 'SQLSTATE = '.$errorInfo[0].', '; |
|
352 | + $msg .= 'Driver Code = '.$errorInfo[1].', '; |
|
353 | 353 | $msg .= 'Driver Message = '.$errorInfo[2]; |
354 | 354 | } |
355 | 355 | return $msg; |
@@ -361,7 +361,7 @@ discard block |
||
361 | 361 | * @param string $table table name without the prefix |
362 | 362 | */ |
363 | 363 | public function dropTable($table) { |
364 | - $table = $this->tablePrefix . trim($table); |
|
364 | + $table = $this->tablePrefix.trim($table); |
|
365 | 365 | $schema = $this->getSchemaManager(); |
366 | 366 | if ($schema->tablesExist([$table])) { |
367 | 367 | $schema->dropTable($table); |
@@ -375,7 +375,7 @@ discard block |
||
375 | 375 | * @return bool |
376 | 376 | */ |
377 | 377 | public function tableExists($table) { |
378 | - $table = $this->tablePrefix . trim($table); |
|
378 | + $table = $this->tablePrefix.trim($table); |
|
379 | 379 | $schema = $this->getSchemaManager(); |
380 | 380 | return $schema->tablesExist([$table]); |
381 | 381 | } |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | * @return string |
136 | 136 | */ |
137 | 137 | protected function generateTemporaryTableName($name) { |
138 | - return $this->config->getSystemValue('dbtableprefix', 'oc_') . $name . '_' . $this->random->generate(13, ISecureRandom::CHAR_LOWER . ISecureRandom::CHAR_DIGITS); |
|
138 | + return $this->config->getSystemValue('dbtableprefix', 'oc_').$name.'_'.$this->random->generate(13, ISecureRandom::CHAR_LOWER.ISecureRandom::CHAR_DIGITS); |
|
139 | 139 | } |
140 | 140 | |
141 | 141 | /** |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | $indexName = $index->getName(); |
187 | 187 | } else { |
188 | 188 | // avoid conflicts in index names |
189 | - $indexName = $this->config->getSystemValue('dbtableprefix', 'oc_') . $this->random->generate(13, ISecureRandom::CHAR_LOWER); |
|
189 | + $indexName = $this->config->getSystemValue('dbtableprefix', 'oc_').$this->random->generate(13, ISecureRandom::CHAR_LOWER); |
|
190 | 190 | } |
191 | 191 | $newIndexes[] = new Index($indexName, $index->getColumns(), $index->isUnique(), $index->isPrimary()); |
192 | 192 | } |
@@ -271,15 +271,15 @@ discard block |
||
271 | 271 | $quotedSource = $this->connection->quoteIdentifier($sourceName); |
272 | 272 | $quotedTarget = $this->connection->quoteIdentifier($targetName); |
273 | 273 | |
274 | - $this->connection->exec('CREATE TABLE ' . $quotedTarget . ' (LIKE ' . $quotedSource . ')'); |
|
275 | - $this->connection->exec('INSERT INTO ' . $quotedTarget . ' SELECT * FROM ' . $quotedSource); |
|
274 | + $this->connection->exec('CREATE TABLE '.$quotedTarget.' (LIKE '.$quotedSource.')'); |
|
275 | + $this->connection->exec('INSERT INTO '.$quotedTarget.' SELECT * FROM '.$quotedSource); |
|
276 | 276 | } |
277 | 277 | |
278 | 278 | /** |
279 | 279 | * @param string $name |
280 | 280 | */ |
281 | 281 | protected function dropTable($name) { |
282 | - $this->connection->exec('DROP TABLE ' . $this->connection->quoteIdentifier($name)); |
|
282 | + $this->connection->exec('DROP TABLE '.$this->connection->quoteIdentifier($name)); |
|
283 | 283 | } |
284 | 284 | |
285 | 285 | /** |
@@ -287,14 +287,14 @@ discard block |
||
287 | 287 | * @return string |
288 | 288 | */ |
289 | 289 | protected function convertStatementToScript($statement) { |
290 | - $script = $statement . ';'; |
|
290 | + $script = $statement.';'; |
|
291 | 291 | $script .= PHP_EOL; |
292 | 292 | $script .= PHP_EOL; |
293 | 293 | return $script; |
294 | 294 | } |
295 | 295 | |
296 | 296 | protected function getFilterExpression() { |
297 | - return '/^' . preg_quote($this->config->getSystemValue('dbtableprefix', 'oc_')) . '/'; |
|
297 | + return '/^'.preg_quote($this->config->getSystemValue('dbtableprefix', 'oc_')).'/'; |
|
298 | 298 | } |
299 | 299 | |
300 | 300 | protected function emit($sql, $step, $max) { |