Passed
Push — master ( f0dd71...c56a27 )
by Christoph
11:49 queued 12s
created
lib/public/AppFramework/Http/Template/PublicTemplateResponse.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -98,7 +98,7 @@
 block discarded – undo
98 98
 			}
99 99
 			$this->headerActions[] = $action;
100 100
 		}
101
-		usort($this->headerActions, function (IMenuAction $a, IMenuAction $b) {
101
+		usort($this->headerActions, function(IMenuAction $a, IMenuAction $b) {
102 102
 			return $a->getPriority() > $b->getPriority();
103 103
 		});
104 104
 	}
Please login to merge, or discard this patch.
lib/public/AppFramework/OCSController.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -61,15 +61,15 @@
 block discarded – undo
61 61
 	 */
62 62
 	public function __construct($appName,
63 63
 								IRequest $request,
64
-								$corsMethods='PUT, POST, GET, DELETE, PATCH',
65
-								$corsAllowedHeaders='Authorization, Content-Type, Accept',
66
-								$corsMaxAge=1728000) {
64
+								$corsMethods = 'PUT, POST, GET, DELETE, PATCH',
65
+								$corsAllowedHeaders = 'Authorization, Content-Type, Accept',
66
+								$corsMaxAge = 1728000) {
67 67
 		parent::__construct($appName, $request, $corsMethods,
68 68
 							$corsAllowedHeaders, $corsMaxAge);
69
-		$this->registerResponder('json', function ($data) {
69
+		$this->registerResponder('json', function($data) {
70 70
 			return $this->buildOCSResponse('json', $data);
71 71
 		});
72
-		$this->registerResponder('xml', function ($data) {
72
+		$this->registerResponder('xml', function($data) {
73 73
 			return $this->buildOCSResponse('xml', $data);
74 74
 		});
75 75
 	}
Please login to merge, or discard this patch.
lib/public/AppFramework/Db/Entity.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -51,8 +51,8 @@  discard block
 block discarded – undo
51 51
 	public static function fromParams(array $params) {
52 52
 		$instance = new static();
53 53
 
54
-		foreach($params as $key => $value) {
55
-			$method = 'set' . ucfirst($key);
54
+		foreach ($params as $key => $value) {
55
+			$method = 'set'.ucfirst($key);
56 56
 			$instance->$method($value);
57 57
 		}
58 58
 
@@ -68,9 +68,9 @@  discard block
 block discarded – undo
68 68
 	public static function fromRow(array $row) {
69 69
 		$instance = new static();
70 70
 
71
-		foreach($row as $key => $value){
71
+		foreach ($row as $key => $value) {
72 72
 			$prop = ucfirst($instance->columnToProperty($key));
73
-			$setter = 'set' . $prop;
73
+			$setter = 'set'.$prop;
74 74
 			$instance->$setter($value);
75 75
 		}
76 76
 
@@ -103,20 +103,20 @@  discard block
 block discarded – undo
103 103
 	 */
104 104
 	protected function setter($name, $args) {
105 105
 		// setters should only work for existing attributes
106
-		if(property_exists($this, $name)){
107
-			if($this->$name === $args[0]) {
106
+		if (property_exists($this, $name)) {
107
+			if ($this->$name === $args[0]) {
108 108
 				return;
109 109
 			}
110 110
 			$this->markFieldUpdated($name);
111 111
 
112 112
 			// if type definition exists, cast to correct type
113
-			if($args[0] !== null && array_key_exists($name, $this->_fieldTypes)) {
113
+			if ($args[0] !== null && array_key_exists($name, $this->_fieldTypes)) {
114 114
 				settype($args[0], $this->_fieldTypes[$name]);
115 115
 			}
116 116
 			$this->$name = $args[0];
117 117
 
118 118
 		} else {
119
-			throw new \BadFunctionCallException($name .
119
+			throw new \BadFunctionCallException($name.
120 120
 				' is not a valid attribute');
121 121
 		}
122 122
 	}
@@ -127,10 +127,10 @@  discard block
 block discarded – undo
127 127
 	 */
128 128
 	protected function getter($name) {
129 129
 		// getters should only work for existing attributes
130
-		if(property_exists($this, $name)){
130
+		if (property_exists($this, $name)) {
131 131
 			return $this->$name;
132 132
 		} else {
133
-			throw new \BadFunctionCallException($name .
133
+			throw new \BadFunctionCallException($name.
134 134
 				' is not a valid attribute');
135 135
 		}
136 136
 	}
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 		} elseif ($this->isGetterForBoolProperty($methodName)) {
152 152
 			return $this->getter(lcfirst(substr($methodName, 2)));
153 153
 		} else {
154
-			throw new \BadFunctionCallException($methodName .
154
+			throw new \BadFunctionCallException($methodName.
155 155
 				' does not exist');
156 156
 		}
157 157
 
@@ -190,8 +190,8 @@  discard block
 block discarded – undo
190 190
 		$parts = explode('_', $columnName);
191 191
 		$property = null;
192 192
 
193
-		foreach($parts as $part){
194
-			if($property === null){
193
+		foreach ($parts as $part) {
194
+			if ($property === null) {
195 195
 				$property = $part;
196 196
 			} else {
197 197
 				$property .= ucfirst($part);
@@ -212,11 +212,11 @@  discard block
 block discarded – undo
212 212
 		$parts = preg_split('/(?=[A-Z])/', $property);
213 213
 		$column = null;
214 214
 
215
-		foreach($parts as $part){
216
-			if($column === null){
215
+		foreach ($parts as $part) {
216
+			if ($column === null) {
217 217
 				$column = $part;
218 218
 			} else {
219
-				$column .= '_' . lcfirst($part);
219
+				$column .= '_'.lcfirst($part);
220 220
 			}
221 221
 		}
222 222
 
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
 	 */
255 255
 	public function slugify($attributeName) {
256 256
 		// toSlug should only work for existing attributes
257
-		if(property_exists($this, $attributeName)){
257
+		if (property_exists($this, $attributeName)) {
258 258
 			$value = $this->$attributeName;
259 259
 			// replace everything except alphanumeric with a single '-'
260 260
 			$value = preg_replace('/[^A-Za-z0-9]+/', '-', $value);
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
 			// trim '-'
263 263
 			return trim($value, '-');
264 264
 		} else {
265
-			throw new \BadFunctionCallException($attributeName .
265
+			throw new \BadFunctionCallException($attributeName.
266 266
 				' is not a valid attribute');
267 267
 		}
268 268
 	}
Please login to merge, or discard this patch.
lib/public/AppFramework/Db/Mapper.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -49,13 +49,13 @@  discard block
 block discarded – undo
49 49
 	 * @since 7.0.0
50 50
 	 * @deprecated 14.0.0 Move over to QBMapper
51 51
 	 */
52
-	public function __construct(IDBConnection $db, $tableName, $entityClass=null) {
52
+	public function __construct(IDBConnection $db, $tableName, $entityClass = null) {
53 53
 		$this->db = $db;
54
-		$this->tableName = '*PREFIX*' . $tableName;
54
+		$this->tableName = '*PREFIX*'.$tableName;
55 55
 
56 56
 		// if not given set the entity name to the class without the mapper part
57 57
 		// cache it here for later use since reflection is slow
58
-		if($entityClass === null) {
58
+		if ($entityClass === null) {
59 59
 			$this->entityClass = str_replace('Mapper', '', get_class($this));
60 60
 		} else {
61 61
 			$this->entityClass = $entityClass;
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 	 * @deprecated 14.0.0 Move over to QBMapper
82 82
 	 */
83 83
 	public function delete(Entity $entity) {
84
-		$sql = 'DELETE FROM `' . $this->tableName . '` WHERE `id` = ?';
84
+		$sql = 'DELETE FROM `'.$this->tableName.'` WHERE `id` = ?';
85 85
 		$stmt = $this->execute($sql, [$entity->getId()]);
86 86
 		$stmt->closeCursor();
87 87
 		return $entity;
@@ -105,15 +105,15 @@  discard block
 block discarded – undo
105 105
 
106 106
 		// build the fields
107 107
 		$i = 0;
108
-		foreach($properties as $property => $updated) {
108
+		foreach ($properties as $property => $updated) {
109 109
 			$column = $entity->propertyToColumn($property);
110
-			$getter = 'get' . ucfirst($property);
110
+			$getter = 'get'.ucfirst($property);
111 111
 
112
-			$columns .= '`' . $column . '`';
112
+			$columns .= '`'.$column.'`';
113 113
 			$values .= '?';
114 114
 
115 115
 			// only append colon if there are more entries
116
-			if($i < count($properties)-1){
116
+			if ($i < count($properties) - 1) {
117 117
 				$columns .= ',';
118 118
 				$values .= ',';
119 119
 			}
@@ -123,8 +123,8 @@  discard block
 block discarded – undo
123 123
 
124 124
 		}
125 125
 
126
-		$sql = 'INSERT INTO `' . $this->tableName . '`(' .
127
-				$columns . ') VALUES(' . $values . ')';
126
+		$sql = 'INSERT INTO `'.$this->tableName.'`('.
127
+				$columns.') VALUES('.$values.')';
128 128
 
129 129
 		$stmt = $this->execute($sql, $params);
130 130
 
@@ -148,13 +148,13 @@  discard block
 block discarded – undo
148 148
 	public function update(Entity $entity) {
149 149
 		// if entity wasn't changed it makes no sense to run a db query
150 150
 		$properties = $entity->getUpdatedFields();
151
-		if(count($properties) === 0) {
151
+		if (count($properties) === 0) {
152 152
 			return $entity;
153 153
 		}
154 154
 
155 155
 		// entity needs an id
156 156
 		$id = $entity->getId();
157
-		if($id === null){
157
+		if ($id === null) {
158 158
 			throw new \InvalidArgumentException(
159 159
 				'Entity which should be updated has no id');
160 160
 		}
@@ -169,15 +169,15 @@  discard block
 block discarded – undo
169 169
 
170 170
 		// build the fields
171 171
 		$i = 0;
172
-		foreach($properties as $property => $updated) {
172
+		foreach ($properties as $property => $updated) {
173 173
 
174 174
 			$column = $entity->propertyToColumn($property);
175
-			$getter = 'get' . ucfirst($property);
175
+			$getter = 'get'.ucfirst($property);
176 176
 
177
-			$columns .= '`' . $column . '` = ?';
177
+			$columns .= '`'.$column.'` = ?';
178 178
 
179 179
 			// only append colon if there are more entries
180
-			if($i < count($properties)-1){
180
+			if ($i < count($properties) - 1) {
181 181
 				$columns .= ',';
182 182
 			}
183 183
 
@@ -185,8 +185,8 @@  discard block
 block discarded – undo
185 185
 			$i++;
186 186
 		}
187 187
 
188
-		$sql = 'UPDATE `' . $this->tableName . '` SET ' .
189
-				$columns . ' WHERE `id` = ?';
188
+		$sql = 'UPDATE `'.$this->tableName.'` SET '.
189
+				$columns.' WHERE `id` = ?';
190 190
 		$params[] = $id;
191 191
 
192 192
 		$stmt = $this->execute($sql, $params);
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
 	 * @since 7.0.0
236 236
 	 * @deprecated 14.0.0 Move over to QBMapper
237 237
 	 */
238
-	protected function execute($sql, array $params=[], $limit=null, $offset=null) {
238
+	protected function execute($sql, array $params = [], $limit = null, $offset = null) {
239 239
 		$query = $this->db->prepare($sql, $limit, $offset);
240 240
 
241 241
 		if ($this->isAssocArray($params)) {
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
 				$query->bindValue($key, $param, $pdoConstant);
245 245
 			}
246 246
 		} else {
247
-			$index = 1;  // bindParam is 1 indexed
247
+			$index = 1; // bindParam is 1 indexed
248 248
 			foreach ($params as $param) {
249 249
 				$pdoConstant = $this->getPDOType($param);
250 250
 				$query->bindValue($index, $param, $pdoConstant);
@@ -271,11 +271,11 @@  discard block
 block discarded – undo
271 271
 	 * @since 7.0.0
272 272
 	 * @deprecated 14.0.0 Move over to QBMapper
273 273
 	 */
274
-	protected function findOneQuery($sql, array $params=[], $limit=null, $offset=null) {
274
+	protected function findOneQuery($sql, array $params = [], $limit = null, $offset = null) {
275 275
 		$stmt = $this->execute($sql, $params, $limit, $offset);
276 276
 		$row = $stmt->fetch();
277 277
 
278
-		if($row === false || $row === null){
278
+		if ($row === false || $row === null) {
279 279
 			$stmt->closeCursor();
280 280
 			$msg = $this->buildDebugMessage(
281 281
 				'Did expect one result but found none when executing', $sql, $params, $limit, $offset
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
 		$row2 = $stmt->fetch();
286 286
 		$stmt->closeCursor();
287 287
 		//MDB2 returns null, PDO and doctrine false when no row is available
288
-		if( ! ($row2 === false || $row2 === null )) {
288
+		if (!($row2 === false || $row2 === null)) {
289 289
 			$msg = $this->buildDebugMessage(
290 290
 				'Did not expect more than one result when executing', $sql, $params, $limit, $offset
291 291
 			);
@@ -307,12 +307,12 @@  discard block
 block discarded – undo
307 307
 	 * @since 9.1.0
308 308
 	 * @deprecated 14.0.0 Move over to QBMapper
309 309
 	 */
310
-	private function buildDebugMessage($msg, $sql, array $params=[], $limit=null, $offset=null) {
311
-		return $msg .
312
-					': query "' .	$sql . '"; ' .
313
-					'parameters ' . print_r($params, true) . '; ' .
314
-					'limit "' . $limit . '"; '.
315
-					'offset "' . $offset . '"';
310
+	private function buildDebugMessage($msg, $sql, array $params = [], $limit = null, $offset = null) {
311
+		return $msg.
312
+					': query "'.$sql.'"; '.
313
+					'parameters '.print_r($params, true).'; '.
314
+					'limit "'.$limit.'"; '.
315
+					'offset "'.$offset.'"';
316 316
 	}
317 317
 
318 318
 
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
 	 * @deprecated 14.0.0 Move over to QBMapper
326 326
 	 */
327 327
 	protected function mapRowToEntity($row) {
328
-		return call_user_func($this->entityClass .'::fromRow', $row);
328
+		return call_user_func($this->entityClass.'::fromRow', $row);
329 329
 	}
330 330
 
331 331
 
@@ -339,12 +339,12 @@  discard block
 block discarded – undo
339 339
 	 * @since 7.0.0
340 340
 	 * @deprecated 14.0.0 Move over to QBMapper
341 341
 	 */
342
-	protected function findEntities($sql, array $params=[], $limit=null, $offset=null) {
342
+	protected function findEntities($sql, array $params = [], $limit = null, $offset = null) {
343 343
 		$stmt = $this->execute($sql, $params, $limit, $offset);
344 344
 
345 345
 		$entities = [];
346 346
 
347
-		while($row = $stmt->fetch()){
347
+		while ($row = $stmt->fetch()) {
348 348
 			$entities[] = $this->mapRowToEntity($row);
349 349
 		}
350 350
 
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
 	 * @since 7.0.0
368 368
 	 * @deprecated 14.0.0 Move over to QBMapper
369 369
 	 */
370
-	protected function findEntity($sql, array $params=[], $limit=null, $offset=null) {
370
+	protected function findEntity($sql, array $params = [], $limit = null, $offset = null) {
371 371
 		return $this->mapRowToEntity($this->findOneQuery($sql, $params, $limit, $offset));
372 372
 	}
373 373
 
Please login to merge, or discard this patch.
lib/public/AppFramework/Db/QBMapper.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -58,13 +58,13 @@  discard block
 block discarded – undo
58 58
 	 * mapped to queries without using sql
59 59
 	 * @since 14.0.0
60 60
 	 */
61
-	public function __construct(IDBConnection $db, string $tableName, string $entityClass=null) {
61
+	public function __construct(IDBConnection $db, string $tableName, string $entityClass = null) {
62 62
 		$this->db = $db;
63 63
 		$this->tableName = $tableName;
64 64
 
65 65
 		// if not given set the entity name to the class without the mapper part
66 66
 		// cache it here for later use since reflection is slow
67
-		if($entityClass === null) {
67
+		if ($entityClass === null) {
68 68
 			$this->entityClass = str_replace('Mapper', '', \get_class($this));
69 69
 		} else {
70 70
 			$this->entityClass = $entityClass;
@@ -117,9 +117,9 @@  discard block
 block discarded – undo
117 117
 		$qb->insert($this->tableName);
118 118
 
119 119
 		// build the fields
120
-		foreach($properties as $property => $updated) {
120
+		foreach ($properties as $property => $updated) {
121 121
 			$column = $entity->propertyToColumn($property);
122
-			$getter = 'get' . ucfirst($property);
122
+			$getter = 'get'.ucfirst($property);
123 123
 			$value = $entity->$getter();
124 124
 
125 125
 			$type = $this->getParameterTypeForProperty($entity, $property);
@@ -128,9 +128,9 @@  discard block
 block discarded – undo
128 128
 
129 129
 		$qb->execute();
130 130
 
131
-		if($entity->id === null) {
131
+		if ($entity->id === null) {
132 132
 			// When autoincrement is used id is always an int
133
-			$entity->setId((int)$qb->getLastInsertId());
133
+			$entity->setId((int) $qb->getLastInsertId());
134 134
 		}
135 135
 
136 136
 		return $entity;
@@ -166,13 +166,13 @@  discard block
 block discarded – undo
166 166
 	public function update(Entity $entity): Entity {
167 167
 		// if entity wasn't changed it makes no sense to run a db query
168 168
 		$properties = $entity->getUpdatedFields();
169
-		if(\count($properties) === 0) {
169
+		if (\count($properties) === 0) {
170 170
 			return $entity;
171 171
 		}
172 172
 
173 173
 		// entity needs an id
174 174
 		$id = $entity->getId();
175
-		if($id === null){
175
+		if ($id === null) {
176 176
 			throw new \InvalidArgumentException(
177 177
 				'Entity which should be updated has no id');
178 178
 		}
@@ -186,9 +186,9 @@  discard block
 block discarded – undo
186 186
 		$qb->update($this->tableName);
187 187
 
188 188
 		// build the fields
189
-		foreach($properties as $property => $updated) {
189
+		foreach ($properties as $property => $updated) {
190 190
 			$column = $entity->propertyToColumn($property);
191
-			$getter = 'get' . ucfirst($property);
191
+			$getter = 'get'.ucfirst($property);
192 192
 			$value = $entity->$getter();
193 193
 
194 194
 			$type = $this->getParameterTypeForProperty($entity, $property);
@@ -217,11 +217,11 @@  discard block
 block discarded – undo
217 217
 	protected function getParameterTypeForProperty(Entity $entity, string $property): int {
218 218
 		$types = $entity->getFieldTypes();
219 219
 
220
-		if(!isset($types[ $property ])) {
220
+		if (!isset($types[$property])) {
221 221
 			return IQueryBuilder::PARAM_STR;
222 222
 		}
223 223
 
224
-		switch($types[ $property ]) {
224
+		switch ($types[$property]) {
225 225
 			case 'int':
226 226
 			case 'integer':
227 227
 				return IQueryBuilder::PARAM_INT;
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
 		$cursor = $query->execute();
252 252
 
253 253
 		$row = $cursor->fetch();
254
-		if($row === false) {
254
+		if ($row === false) {
255 255
 			$cursor->closeCursor();
256 256
 			$msg = $this->buildDebugMessage(
257 257
 				'Did expect one result but found none when executing', $query
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
 
262 262
 		$row2 = $cursor->fetch();
263 263
 		$cursor->closeCursor();
264
-		if($row2 !== false ) {
264
+		if ($row2 !== false) {
265 265
 			$msg = $this->buildDebugMessage(
266 266
 				'Did not expect more than one result when executing', $query
267 267
 			);
@@ -278,8 +278,8 @@  discard block
 block discarded – undo
278 278
 	 * @since 14.0.0
279 279
 	 */
280 280
 	private function buildDebugMessage(string $msg, IQueryBuilder $sql): string {
281
-		return $msg .
282
-			': query "' . $sql->getSQL() . '"; ';
281
+		return $msg.
282
+			': query "'.$sql->getSQL().'"; ';
283 283
 	}
284 284
 
285 285
 
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
 	 * @since 14.0.0
293 293
 	 */
294 294
 	protected function mapRowToEntity(array $row): Entity {
295
-		return \call_user_func($this->entityClass .'::fromRow', $row);
295
+		return \call_user_func($this->entityClass.'::fromRow', $row);
296 296
 	}
297 297
 
298 298
 
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
 
309 309
 		$entities = [];
310 310
 
311
-		while($row = $cursor->fetch()){
311
+		while ($row = $cursor->fetch()) {
312 312
 			$entities[] = $this->mapRowToEntity($row);
313 313
 		}
314 314
 
Please login to merge, or discard this patch.
lib/public/App.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 	 * @deprecated 14.0.0 Use settings section in appinfo.xml to register personal admin sections
58 58
 	 */
59 59
 	public static function registerPersonal($app, $page) {
60
-		\OC_App::registerPersonal( $app, $page );
60
+		\OC_App::registerPersonal($app, $page);
61 61
 	}
62 62
 
63 63
 	/**
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 	 * @deprecated 14.0.0 Use settings section in appinfo.xml to register admin sections
70 70
 	 */
71 71
 	public static function registerAdmin($app, $page) {
72
-		\OC_App::registerAdmin( $app, $page );
72
+		\OC_App::registerAdmin($app, $page);
73 73
 	}
74 74
 
75 75
 	/**
@@ -80,8 +80,8 @@  discard block
 block discarded – undo
80 80
 	 * @deprecated 14.0.0 ise \OC::$server->getAppManager()->getAppInfo($appId)
81 81
 	 * @since 4.0.0
82 82
 	 */
83
-	public static function getAppInfo($app, $path=false) {
84
-		return \OC_App::getAppInfo( $app, $path);
83
+	public static function getAppInfo($app, $path = false) {
84
+		return \OC_App::getAppInfo($app, $path);
85 85
 	}
86 86
 
87 87
 	/**
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 	 * @deprecated 13.0.0 use \OC::$server->getAppManager()->isEnabledForUser($appId)
95 95
 	 */
96 96
 	public static function isEnabled($app) {
97
-		return \OC::$server->getAppManager()->isEnabledForUser( $app );
97
+		return \OC::$server->getAppManager()->isEnabledForUser($app);
98 98
 	}
99 99
 
100 100
 	/**
Please login to merge, or discard this patch.