@@ -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 | /** |
@@ -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]); |
@@ -333,7 +333,7 @@ |
||
333 | 333 | */ |
334 | 334 | protected function registerCoreProvider($class, $mimeType, $options = []) { |
335 | 335 | if (in_array(trim($class, '\\'), $this->getEnabledDefaultProvider())) { |
336 | - $this->registerProvider($mimeType, function () use ($class, $options) { |
|
336 | + $this->registerProvider($mimeType, function() use ($class, $options) { |
|
337 | 337 | return new $class($options); |
338 | 338 | }); |
339 | 339 | } |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | } |
98 | 98 | |
99 | 99 | public function get($key) { |
100 | - $result = self::$cache->get($this->getNameSpace() . $key); |
|
100 | + $result = self::$cache->get($this->getNameSpace().$key); |
|
101 | 101 | if ($result === false and self::$cache->getResultCode() == \Memcached::RES_NOTFOUND) { |
102 | 102 | return null; |
103 | 103 | } else { |
@@ -107,9 +107,9 @@ discard block |
||
107 | 107 | |
108 | 108 | public function set($key, $value, $ttl = 0) { |
109 | 109 | if ($ttl > 0) { |
110 | - $result = self::$cache->set($this->getNameSpace() . $key, $value, $ttl); |
|
110 | + $result = self::$cache->set($this->getNameSpace().$key, $value, $ttl); |
|
111 | 111 | } else { |
112 | - $result = self::$cache->set($this->getNameSpace() . $key, $value); |
|
112 | + $result = self::$cache->set($this->getNameSpace().$key, $value); |
|
113 | 113 | } |
114 | 114 | if ($result !== true) { |
115 | 115 | $this->verifyReturnCode(); |
@@ -118,12 +118,12 @@ discard block |
||
118 | 118 | } |
119 | 119 | |
120 | 120 | public function hasKey($key) { |
121 | - self::$cache->get($this->getNameSpace() . $key); |
|
121 | + self::$cache->get($this->getNameSpace().$key); |
|
122 | 122 | return self::$cache->getResultCode() === \Memcached::RES_SUCCESS; |
123 | 123 | } |
124 | 124 | |
125 | 125 | public function remove($key) { |
126 | - $result = self::$cache->delete($this->getNameSpace() . $key); |
|
126 | + $result = self::$cache->delete($this->getNameSpace().$key); |
|
127 | 127 | if (self::$cache->getResultCode() !== \Memcached::RES_NOTFOUND) { |
128 | 128 | $this->verifyReturnCode(); |
129 | 129 | } |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | } |
132 | 132 | |
133 | 133 | public function clear($prefix = '') { |
134 | - $prefix = $this->getNameSpace() . $prefix; |
|
134 | + $prefix = $this->getNameSpace().$prefix; |
|
135 | 135 | $allKeys = self::$cache->getAllKeys(); |
136 | 136 | if ($allKeys === false) { |
137 | 137 | // newer Memcached doesn't like getAllKeys(), flush everything |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | * @throws \Exception |
166 | 166 | */ |
167 | 167 | public function add($key, $value, $ttl = 0) { |
168 | - $result = self::$cache->add($this->getPrefix() . $key, $value, $ttl); |
|
168 | + $result = self::$cache->add($this->getPrefix().$key, $value, $ttl); |
|
169 | 169 | if (self::$cache->getResultCode() !== \Memcached::RES_NOTSTORED) { |
170 | 170 | $this->verifyReturnCode(); |
171 | 171 | } |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | */ |
182 | 182 | public function inc($key, $step = 1) { |
183 | 183 | $this->add($key, 0); |
184 | - $result = self::$cache->increment($this->getPrefix() . $key, $step); |
|
184 | + $result = self::$cache->increment($this->getPrefix().$key, $step); |
|
185 | 185 | |
186 | 186 | if (self::$cache->getResultCode() !== \Memcached::RES_SUCCESS) { |
187 | 187 | return false; |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | * @return int | bool |
199 | 199 | */ |
200 | 200 | public function dec($key, $step = 1) { |
201 | - $result = self::$cache->decrement($this->getPrefix() . $key, $step); |
|
201 | + $result = self::$cache->decrement($this->getPrefix().$key, $step); |
|
202 | 202 | |
203 | 203 | if (self::$cache->getResultCode() !== \Memcached::RES_SUCCESS) { |
204 | 204 | return false; |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | use CADTrait; |
38 | 38 | |
39 | 39 | public function get($key) { |
40 | - $result = apcu_fetch($this->getPrefix() . $key, $success); |
|
40 | + $result = apcu_fetch($this->getPrefix().$key, $success); |
|
41 | 41 | if (!$success) { |
42 | 42 | return null; |
43 | 43 | } |
@@ -45,24 +45,24 @@ discard block |
||
45 | 45 | } |
46 | 46 | |
47 | 47 | public function set($key, $value, $ttl = 0) { |
48 | - return apcu_store($this->getPrefix() . $key, $value, $ttl); |
|
48 | + return apcu_store($this->getPrefix().$key, $value, $ttl); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | public function hasKey($key) { |
52 | - return apcu_exists($this->getPrefix() . $key); |
|
52 | + return apcu_exists($this->getPrefix().$key); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | public function remove($key) { |
56 | - return apcu_delete($this->getPrefix() . $key); |
|
56 | + return apcu_delete($this->getPrefix().$key); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | public function clear($prefix = '') { |
60 | - $ns = $this->getPrefix() . $prefix; |
|
60 | + $ns = $this->getPrefix().$prefix; |
|
61 | 61 | $ns = preg_quote($ns, '/'); |
62 | 62 | if (class_exists('\APCIterator')) { |
63 | - $iter = new \APCIterator('user', '/^' . $ns . '/', APC_ITER_KEY); |
|
63 | + $iter = new \APCIterator('user', '/^'.$ns.'/', APC_ITER_KEY); |
|
64 | 64 | } else { |
65 | - $iter = new \APCUIterator('/^' . $ns . '/', APC_ITER_KEY); |
|
65 | + $iter = new \APCUIterator('/^'.$ns.'/', APC_ITER_KEY); |
|
66 | 66 | } |
67 | 67 | return apcu_delete($iter); |
68 | 68 | } |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | * @return bool |
77 | 77 | */ |
78 | 78 | public function add($key, $value, $ttl = 0) { |
79 | - return apcu_add($this->getPrefix() . $key, $value, $ttl); |
|
79 | + return apcu_add($this->getPrefix().$key, $value, $ttl); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | /** |
@@ -100,8 +100,8 @@ discard block |
||
100 | 100 | * see https://github.com/krakjoe/apcu/issues/183#issuecomment-244038221 |
101 | 101 | * for details |
102 | 102 | */ |
103 | - return apcu_exists($this->getPrefix() . $key) |
|
104 | - ? apcu_inc($this->getPrefix() . $key, $step) |
|
103 | + return apcu_exists($this->getPrefix().$key) |
|
104 | + ? apcu_inc($this->getPrefix().$key, $step) |
|
105 | 105 | : false; |
106 | 106 | } |
107 | 107 | |
@@ -125,8 +125,8 @@ discard block |
||
125 | 125 | * see https://github.com/krakjoe/apcu/issues/183#issuecomment-244038221 |
126 | 126 | * for details |
127 | 127 | */ |
128 | - return apcu_exists($this->getPrefix() . $key) |
|
129 | - ? apcu_dec($this->getPrefix() . $key, $step) |
|
128 | + return apcu_exists($this->getPrefix().$key) |
|
129 | + ? apcu_dec($this->getPrefix().$key, $step) |
|
130 | 130 | : false; |
131 | 131 | } |
132 | 132 | |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | public function cas($key, $old, $new) { |
142 | 142 | // apc only does cas for ints |
143 | 143 | if (is_int($old) and is_int($new)) { |
144 | - return apcu_cas($this->getPrefix() . $key, $old, $new); |
|
144 | + return apcu_cas($this->getPrefix().$key, $old, $new); |
|
145 | 145 | } else { |
146 | 146 | return $this->casEmulated($key, $old, $new); |
147 | 147 | } |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | IUserSession $userSession |
61 | 61 | ) { |
62 | 62 | $this->user = $user; |
63 | - $this->isAdmin = (bool)$isAdmin; |
|
63 | + $this->isAdmin = (bool) $isAdmin; |
|
64 | 64 | $this->groupManager = $groupManager; |
65 | 65 | $this->userSession = $userSession; |
66 | 66 | } |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | * @return array |
77 | 77 | */ |
78 | 78 | public function get($groupSearch = '', $userSearch = '') { |
79 | - $key = $groupSearch . '::' . $userSearch; |
|
79 | + $key = $groupSearch.'::'.$userSearch; |
|
80 | 80 | if (isset($this->metaData[$key])) { |
81 | 81 | return $this->metaData[$key]; |
82 | 82 | } |
@@ -67,7 +67,7 @@ |
||
67 | 67 | * compared with \OC\Group\Backend::CREATE_GROUP etc. |
68 | 68 | */ |
69 | 69 | public function implementsActions($actions) { |
70 | - return (bool)($this->getSupportedActions() & $actions); |
|
70 | + return (bool) ($this->getSupportedActions() & $actions); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | /** |