@@ -135,7 +135,7 @@ |
||
135 | 135 | * @return $this |
136 | 136 | */ |
137 | 137 | public function addHeader($name, $value) { |
138 | - $name = trim($name); // always remove leading and trailing whitespace |
|
138 | + $name = trim($name); // always remove leading and trailing whitespace |
|
139 | 139 | // to be able to reliably check for security |
140 | 140 | // headers |
141 | 141 |
@@ -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 | } |
@@ -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 { |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | */ |
67 | 67 | public function lockTable($tableName) { |
68 | 68 | $this->conn->beginTransaction(); |
69 | - $this->conn->executeUpdate('LOCK TABLE `' .$tableName . '` IN EXCLUSIVE MODE'); |
|
69 | + $this->conn->executeUpdate('LOCK TABLE `'.$tableName.'` IN EXCLUSIVE MODE'); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | /** |
@@ -93,14 +93,14 @@ discard block |
||
93 | 93 | if (empty($compare)) { |
94 | 94 | $compare = array_keys($input); |
95 | 95 | } |
96 | - $query = 'INSERT INTO `' .$table . '` (`' |
|
97 | - . implode('`,`', array_keys($input)) . '`) SELECT ' |
|
96 | + $query = 'INSERT INTO `'.$table.'` (`' |
|
97 | + . implode('`,`', array_keys($input)).'`) SELECT ' |
|
98 | 98 | . str_repeat('?,', count($input) - 1).'? ' // Is there a prettier alternative? |
99 | - . 'FROM `' . $table . '` WHERE '; |
|
99 | + . 'FROM `'.$table.'` WHERE '; |
|
100 | 100 | |
101 | 101 | $inserts = array_values($input); |
102 | 102 | foreach ($compare as $key) { |
103 | - $query .= '`' . $key . '`'; |
|
103 | + $query .= '`'.$key.'`'; |
|
104 | 104 | if (is_null($input[$key])) { |
105 | 105 | $query .= ' IS NULL AND '; |
106 | 106 | } else { |
@@ -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]); |
@@ -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 | } |
@@ -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 | /** |
@@ -133,10 +133,10 @@ discard block |
||
133 | 133 | |
134 | 134 | // Check that all parameters from $event exist in $previousEvent |
135 | 135 | foreach ($params1 as $key => $parameter) { |
136 | - if (preg_match('/^' . $mergeParameter . '(\d+)?$/', $key)) { |
|
136 | + if (preg_match('/^'.$mergeParameter.'(\d+)?$/', $key)) { |
|
137 | 137 | if (!$this->checkParameterAlreadyExits($params, $mergeParameter, $parameter)) { |
138 | 138 | $combined++; |
139 | - $params[$mergeParameter . $combined] = $parameter; |
|
139 | + $params[$mergeParameter.$combined] = $parameter; |
|
140 | 140 | } |
141 | 141 | continue; |
142 | 142 | } |
@@ -151,10 +151,10 @@ discard block |
||
151 | 151 | |
152 | 152 | // Check that all parameters from $previousEvent exist in $event |
153 | 153 | foreach ($params2 as $key => $parameter) { |
154 | - if (preg_match('/^' . $mergeParameter . '(\d+)?$/', $key)) { |
|
154 | + if (preg_match('/^'.$mergeParameter.'(\d+)?$/', $key)) { |
|
155 | 155 | if (!$this->checkParameterAlreadyExits($params, $mergeParameter, $parameter)) { |
156 | 156 | $combined++; |
157 | - $params[$mergeParameter . $combined] = $parameter; |
|
157 | + $params[$mergeParameter.$combined] = $parameter; |
|
158 | 158 | } |
159 | 159 | continue; |
160 | 160 | } |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | */ |
179 | 179 | protected function checkParameterAlreadyExits($parameters, $mergeParameter, $parameter) { |
180 | 180 | foreach ($parameters as $key => $param) { |
181 | - if (preg_match('/^' . $mergeParameter . '(\d+)?$/', $key)) { |
|
181 | + if (preg_match('/^'.$mergeParameter.'(\d+)?$/', $key)) { |
|
182 | 182 | if ($param === $parameter) { |
183 | 183 | return true; |
184 | 184 | } |
@@ -196,30 +196,30 @@ discard block |
||
196 | 196 | protected function getExtendedSubject($subject, $parameter, $counter) { |
197 | 197 | switch ($counter) { |
198 | 198 | case 1: |
199 | - $replacement = '{' . $parameter . '1}'; |
|
199 | + $replacement = '{'.$parameter.'1}'; |
|
200 | 200 | break; |
201 | 201 | case 2: |
202 | 202 | $replacement = $this->l10n->t( |
203 | 203 | '%1$s and %2$s', |
204 | - ['{' . $parameter . '2}', '{' . $parameter . '1}'] |
|
204 | + ['{'.$parameter.'2}', '{'.$parameter.'1}'] |
|
205 | 205 | ); |
206 | 206 | break; |
207 | 207 | case 3: |
208 | 208 | $replacement = $this->l10n->t( |
209 | 209 | '%1$s, %2$s and %3$s', |
210 | - ['{' . $parameter . '3}', '{' . $parameter . '2}', '{' . $parameter . '1}'] |
|
210 | + ['{'.$parameter.'3}', '{'.$parameter.'2}', '{'.$parameter.'1}'] |
|
211 | 211 | ); |
212 | 212 | break; |
213 | 213 | case 4: |
214 | 214 | $replacement = $this->l10n->t( |
215 | 215 | '%1$s, %2$s, %3$s and %4$s', |
216 | - ['{' . $parameter . '4}', '{' . $parameter . '3}', '{' . $parameter . '2}', '{' . $parameter . '1}'] |
|
216 | + ['{'.$parameter.'4}', '{'.$parameter.'3}', '{'.$parameter.'2}', '{'.$parameter.'1}'] |
|
217 | 217 | ); |
218 | 218 | break; |
219 | 219 | case 5: |
220 | 220 | $replacement = $this->l10n->t( |
221 | 221 | '%1$s, %2$s, %3$s, %4$s and %5$s', |
222 | - ['{' . $parameter . '5}', '{' . $parameter . '4}', '{' . $parameter . '3}', '{' . $parameter . '2}', '{' . $parameter . '1}'] |
|
222 | + ['{'.$parameter.'5}', '{'.$parameter.'4}', '{'.$parameter.'3}', '{'.$parameter.'2}', '{'.$parameter.'1}'] |
|
223 | 223 | ); |
224 | 224 | break; |
225 | 225 | default: |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | } |
228 | 228 | |
229 | 229 | return str_replace( |
230 | - '{' . $parameter . '}', |
|
230 | + '{'.$parameter.'}', |
|
231 | 231 | $replacement, |
232 | 232 | $subject |
233 | 233 | ); |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | protected function generateParsedSubject($subject, $parameters) { |
242 | 242 | $placeholders = $replacements = []; |
243 | 243 | foreach ($parameters as $placeholder => $parameter) { |
244 | - $placeholders[] = '{' . $placeholder . '}'; |
|
244 | + $placeholders[] = '{'.$placeholder.'}'; |
|
245 | 245 | if ($parameter['type'] === 'file') { |
246 | 246 | $replacements[] = trim($parameter['path'], '/'); |
247 | 247 | } elseif (isset($parameter['name'])) { |