Completed
Pull Request — master (#8780)
by Joas
22:32
created
lib/private/Group/Database.php 2 patches
Indentation   +306 added lines, -306 removed lines patch added patch discarded remove patch
@@ -47,311 +47,311 @@
 block discarded – undo
47 47
  */
48 48
 class Database extends Backend {
49 49
 
50
-	/** @var string[] */
51
-	private $groupCache = [];
52
-
53
-	/** @var IDBConnection */
54
-	private $dbConn;
55
-
56
-	/**
57
-	 * \OC\Group\Database constructor.
58
-	 *
59
-	 * @param IDBConnection|null $dbConn
60
-	 */
61
-	public function __construct(IDBConnection $dbConn = null) {
62
-		$this->dbConn = $dbConn;
63
-	}
64
-
65
-	/**
66
-	 * FIXME: This function should not be required!
67
-	 */
68
-	private function fixDI() {
69
-		if ($this->dbConn === null) {
70
-			$this->dbConn = \OC::$server->getDatabaseConnection();
71
-		}
72
-	}
73
-
74
-	/**
75
-	 * Try to create a new group
76
-	 * @param string $gid The name of the group to create
77
-	 * @return bool
78
-	 *
79
-	 * Tries to create a new group. If the group name already exists, false will
80
-	 * be returned.
81
-	 */
82
-	public function createGroup( $gid ) {
83
-		$this->fixDI();
84
-
85
-		// Add group
86
-		$result = $this->dbConn->insertIfNotExist('*PREFIX*groups', [
87
-			'gid' => $gid,
88
-		]);
89
-
90
-		// Add to cache
91
-		$this->groupCache[$gid] = $gid;
92
-
93
-		return $result === 1;
94
-	}
95
-
96
-	/**
97
-	 * delete a group
98
-	 * @param string $gid gid of the group to delete
99
-	 * @return bool
100
-	 *
101
-	 * Deletes a group and removes it from the group_user-table
102
-	 */
103
-	public function deleteGroup( $gid ) {
104
-		$this->fixDI();
105
-
106
-		// Delete the group
107
-		$qb = $this->dbConn->getQueryBuilder();
108
-		$qb->delete('groups')
109
-			->where($qb->expr()->eq('gid', $qb->createNamedParameter($gid)))
110
-			->execute();
111
-
112
-		// Delete the group-user relation
113
-		$qb = $this->dbConn->getQueryBuilder();
114
-		$qb->delete('group_user')
115
-			->where($qb->expr()->eq('gid', $qb->createNamedParameter($gid)))
116
-			->execute();
117
-
118
-		// Delete the group-groupadmin relation
119
-		$qb = $this->dbConn->getQueryBuilder();
120
-		$qb->delete('group_admin')
121
-			->where($qb->expr()->eq('gid', $qb->createNamedParameter($gid)))
122
-			->execute();
123
-
124
-		// Delete from cache
125
-		unset($this->groupCache[$gid]);
126
-
127
-		return true;
128
-	}
129
-
130
-	/**
131
-	 * is user in group?
132
-	 * @param string $uid uid of the user
133
-	 * @param string $gid gid of the group
134
-	 * @return bool
135
-	 *
136
-	 * Checks whether the user is member of a group or not.
137
-	 */
138
-	public function inGroup( $uid, $gid ) {
139
-		$this->fixDI();
140
-
141
-		// check
142
-		$qb = $this->dbConn->getQueryBuilder();
143
-		$cursor = $qb->select('uid')
144
-			->from('group_user')
145
-			->where($qb->expr()->eq('gid', $qb->createNamedParameter($gid)))
146
-			->andWhere($qb->expr()->eq('uid', $qb->createNamedParameter($uid)))
147
-			->execute();
148
-
149
-		$result = $cursor->fetch();
150
-		$cursor->closeCursor();
151
-
152
-		return $result ? true : false;
153
-	}
154
-
155
-	/**
156
-	 * Add a user to a group
157
-	 * @param string $uid Name of the user to add to group
158
-	 * @param string $gid Name of the group in which add the user
159
-	 * @return bool
160
-	 *
161
-	 * Adds a user to a group.
162
-	 */
163
-	public function addToGroup( $uid, $gid ) {
164
-		$this->fixDI();
165
-
166
-		// No duplicate entries!
167
-		if( !$this->inGroup( $uid, $gid )) {
168
-			$qb = $this->dbConn->getQueryBuilder();
169
-			$qb->insert('group_user')
170
-				->setValue('uid', $qb->createNamedParameter($uid))
171
-				->setValue('gid', $qb->createNamedParameter($gid))
172
-				->execute();
173
-			return true;
174
-		}else{
175
-			return false;
176
-		}
177
-	}
178
-
179
-	/**
180
-	 * Removes a user from a group
181
-	 * @param string $uid Name of the user to remove from group
182
-	 * @param string $gid Name of the group from which remove the user
183
-	 * @return bool
184
-	 *
185
-	 * removes the user from a group.
186
-	 */
187
-	public function removeFromGroup( $uid, $gid ) {
188
-		$this->fixDI();
189
-
190
-		$qb = $this->dbConn->getQueryBuilder();
191
-		$qb->delete('group_user')
192
-			->where($qb->expr()->eq('uid', $qb->createNamedParameter($uid)))
193
-			->andWhere($qb->expr()->eq('gid', $qb->createNamedParameter($gid)))
194
-			->execute();
195
-
196
-		return true;
197
-	}
198
-
199
-	/**
200
-	 * Get all groups a user belongs to
201
-	 * @param string $uid Name of the user
202
-	 * @return array an array of group names
203
-	 *
204
-	 * This function fetches all groups a user belongs to. It does not check
205
-	 * if the user exists at all.
206
-	 */
207
-	public function getUserGroups( $uid ) {
208
-		//guests has empty or null $uid
209
-		if ($uid === null || $uid === '') {
210
-			return [];
211
-		}
212
-
213
-		$this->fixDI();
214
-
215
-		// No magic!
216
-		$qb = $this->dbConn->getQueryBuilder();
217
-		$cursor = $qb->select('gid')
218
-			->from('group_user')
219
-			->where($qb->expr()->eq('uid', $qb->createNamedParameter($uid)))
220
-			->execute();
221
-
222
-		$groups = [];
223
-		while( $row = $cursor->fetch()) {
224
-			$groups[] = $row['gid'];
225
-			$this->groupCache[$row['gid']] = $row['gid'];
226
-		}
227
-		$cursor->closeCursor();
228
-
229
-		return $groups;
230
-	}
231
-
232
-	/**
233
-	 * get a list of all groups
234
-	 * @param string $search
235
-	 * @param int $limit
236
-	 * @param int $offset
237
-	 * @return array an array of group names
238
-	 *
239
-	 * Returns a list with all groups
240
-	 */
241
-	public function getGroups($search = '', $limit = null, $offset = null) {
242
-		$query = $this->dbConn->getQueryBuilder();
243
-		$query->select('gid')
244
-			->from('groups')
245
-			->orderBy('gid', 'ASC');
246
-
247
-		if ($search !== '') {
248
-			$query->where($query->expr()->iLike('gid', $query->createNamedParameter(
249
-				'%' . $this->dbConn->escapeLikeParameter($search) . '%'
250
-			)));
251
-		}
252
-
253
-		$query->setMaxResults($limit)
254
-			->setFirstResult($offset);
255
-		$result = $query->execute();
256
-
257
-		$groups = [];
258
-		while ($row = $result->fetch()) {
259
-			$groups[] = $row['gid'];
260
-		}
261
-		$result->closeCursor();
262
-
263
-		return $groups;
264
-	}
265
-
266
-	/**
267
-	 * check if a group exists
268
-	 * @param string $gid
269
-	 * @return bool
270
-	 */
271
-	public function groupExists($gid) {
272
-		$this->fixDI();
273
-
274
-		// Check cache first
275
-		if (isset($this->groupCache[$gid])) {
276
-			return true;
277
-		}
278
-
279
-		$qb = $this->dbConn->getQueryBuilder();
280
-		$cursor = $qb->select('gid')
281
-			->from('groups')
282
-			->where($qb->expr()->eq('gid', $qb->createNamedParameter($gid)))
283
-			->execute();
284
-		$result = $cursor->fetch();
285
-		$cursor->closeCursor();
286
-
287
-		if ($result !== false) {
288
-			$this->groupCache[$gid] = $gid;
289
-			return true;
290
-		}
291
-		return false;
292
-	}
293
-
294
-	/**
295
-	 * get a list of all users in a group
296
-	 * @param string $gid
297
-	 * @param string $search
298
-	 * @param int $limit
299
-	 * @param int $offset
300
-	 * @return array an array of user ids
301
-	 */
302
-	public function usersInGroup($gid, $search = '', $limit = null, $offset = null) {
303
-		$query = $this->dbConn->getQueryBuilder();
304
-		$query->select('uid')
305
-			->from('group_user')
306
-			->where($query->expr()->eq('gid', $query->createNamedParameter($gid)))
307
-			->orderBy('uid', 'ASC');
308
-
309
-		if ($search !== '') {
310
-			$query->andWhere($query->expr()->like('uid', $query->createNamedParameter(
311
-				'%' . $this->dbConn->escapeLikeParameter($search) . '%'
312
-			)));
313
-		}
314
-
315
-		$query->setMaxResults($limit)
316
-			->setFirstResult($offset);
317
-		$result = $query->execute();
318
-
319
-		$users = [];
320
-		while ($row = $result->fetch()) {
321
-			$users[] = $row['uid'];
322
-		}
323
-		$result->closeCursor();
324
-
325
-		return $users;
326
-	}
327
-
328
-	/**
329
-	 * get the number of all users matching the search string in a group
330
-	 * @param string $gid
331
-	 * @param string $search
332
-	 * @return int|false
333
-	 */
334
-	public function countUsersInGroup($gid, $search = '') {
335
-		$query = $this->dbConn->getQueryBuilder();
336
-		$query->selectAlias($query->createFunction('COUNT(*)'), 'num_users')
337
-			->from('group_user')
338
-			->where($query->expr()->eq('gid', $query->createNamedParameter($gid)))
339
-			->orderBy('uid', 'ASC');
340
-
341
-		if ($search !== '') {
342
-			$query->andWhere($query->expr()->like('uid', $query->createNamedParameter(
343
-				'%' . $this->dbConn->escapeLikeParameter($search) . '%'
344
-			)));
345
-		}
346
-
347
-		$result = $query->execute();
348
-		$count = $result->fetchColumn();
349
-		$result->closeCursor();
350
-
351
-		if ($count !== false) {
352
-			$count = (int)$count;
353
-		}
354
-		return $count;
355
-	}
50
+    /** @var string[] */
51
+    private $groupCache = [];
52
+
53
+    /** @var IDBConnection */
54
+    private $dbConn;
55
+
56
+    /**
57
+     * \OC\Group\Database constructor.
58
+     *
59
+     * @param IDBConnection|null $dbConn
60
+     */
61
+    public function __construct(IDBConnection $dbConn = null) {
62
+        $this->dbConn = $dbConn;
63
+    }
64
+
65
+    /**
66
+     * FIXME: This function should not be required!
67
+     */
68
+    private function fixDI() {
69
+        if ($this->dbConn === null) {
70
+            $this->dbConn = \OC::$server->getDatabaseConnection();
71
+        }
72
+    }
73
+
74
+    /**
75
+     * Try to create a new group
76
+     * @param string $gid The name of the group to create
77
+     * @return bool
78
+     *
79
+     * Tries to create a new group. If the group name already exists, false will
80
+     * be returned.
81
+     */
82
+    public function createGroup( $gid ) {
83
+        $this->fixDI();
84
+
85
+        // Add group
86
+        $result = $this->dbConn->insertIfNotExist('*PREFIX*groups', [
87
+            'gid' => $gid,
88
+        ]);
89
+
90
+        // Add to cache
91
+        $this->groupCache[$gid] = $gid;
92
+
93
+        return $result === 1;
94
+    }
95
+
96
+    /**
97
+     * delete a group
98
+     * @param string $gid gid of the group to delete
99
+     * @return bool
100
+     *
101
+     * Deletes a group and removes it from the group_user-table
102
+     */
103
+    public function deleteGroup( $gid ) {
104
+        $this->fixDI();
105
+
106
+        // Delete the group
107
+        $qb = $this->dbConn->getQueryBuilder();
108
+        $qb->delete('groups')
109
+            ->where($qb->expr()->eq('gid', $qb->createNamedParameter($gid)))
110
+            ->execute();
111
+
112
+        // Delete the group-user relation
113
+        $qb = $this->dbConn->getQueryBuilder();
114
+        $qb->delete('group_user')
115
+            ->where($qb->expr()->eq('gid', $qb->createNamedParameter($gid)))
116
+            ->execute();
117
+
118
+        // Delete the group-groupadmin relation
119
+        $qb = $this->dbConn->getQueryBuilder();
120
+        $qb->delete('group_admin')
121
+            ->where($qb->expr()->eq('gid', $qb->createNamedParameter($gid)))
122
+            ->execute();
123
+
124
+        // Delete from cache
125
+        unset($this->groupCache[$gid]);
126
+
127
+        return true;
128
+    }
129
+
130
+    /**
131
+     * is user in group?
132
+     * @param string $uid uid of the user
133
+     * @param string $gid gid of the group
134
+     * @return bool
135
+     *
136
+     * Checks whether the user is member of a group or not.
137
+     */
138
+    public function inGroup( $uid, $gid ) {
139
+        $this->fixDI();
140
+
141
+        // check
142
+        $qb = $this->dbConn->getQueryBuilder();
143
+        $cursor = $qb->select('uid')
144
+            ->from('group_user')
145
+            ->where($qb->expr()->eq('gid', $qb->createNamedParameter($gid)))
146
+            ->andWhere($qb->expr()->eq('uid', $qb->createNamedParameter($uid)))
147
+            ->execute();
148
+
149
+        $result = $cursor->fetch();
150
+        $cursor->closeCursor();
151
+
152
+        return $result ? true : false;
153
+    }
154
+
155
+    /**
156
+     * Add a user to a group
157
+     * @param string $uid Name of the user to add to group
158
+     * @param string $gid Name of the group in which add the user
159
+     * @return bool
160
+     *
161
+     * Adds a user to a group.
162
+     */
163
+    public function addToGroup( $uid, $gid ) {
164
+        $this->fixDI();
165
+
166
+        // No duplicate entries!
167
+        if( !$this->inGroup( $uid, $gid )) {
168
+            $qb = $this->dbConn->getQueryBuilder();
169
+            $qb->insert('group_user')
170
+                ->setValue('uid', $qb->createNamedParameter($uid))
171
+                ->setValue('gid', $qb->createNamedParameter($gid))
172
+                ->execute();
173
+            return true;
174
+        }else{
175
+            return false;
176
+        }
177
+    }
178
+
179
+    /**
180
+     * Removes a user from a group
181
+     * @param string $uid Name of the user to remove from group
182
+     * @param string $gid Name of the group from which remove the user
183
+     * @return bool
184
+     *
185
+     * removes the user from a group.
186
+     */
187
+    public function removeFromGroup( $uid, $gid ) {
188
+        $this->fixDI();
189
+
190
+        $qb = $this->dbConn->getQueryBuilder();
191
+        $qb->delete('group_user')
192
+            ->where($qb->expr()->eq('uid', $qb->createNamedParameter($uid)))
193
+            ->andWhere($qb->expr()->eq('gid', $qb->createNamedParameter($gid)))
194
+            ->execute();
195
+
196
+        return true;
197
+    }
198
+
199
+    /**
200
+     * Get all groups a user belongs to
201
+     * @param string $uid Name of the user
202
+     * @return array an array of group names
203
+     *
204
+     * This function fetches all groups a user belongs to. It does not check
205
+     * if the user exists at all.
206
+     */
207
+    public function getUserGroups( $uid ) {
208
+        //guests has empty or null $uid
209
+        if ($uid === null || $uid === '') {
210
+            return [];
211
+        }
212
+
213
+        $this->fixDI();
214
+
215
+        // No magic!
216
+        $qb = $this->dbConn->getQueryBuilder();
217
+        $cursor = $qb->select('gid')
218
+            ->from('group_user')
219
+            ->where($qb->expr()->eq('uid', $qb->createNamedParameter($uid)))
220
+            ->execute();
221
+
222
+        $groups = [];
223
+        while( $row = $cursor->fetch()) {
224
+            $groups[] = $row['gid'];
225
+            $this->groupCache[$row['gid']] = $row['gid'];
226
+        }
227
+        $cursor->closeCursor();
228
+
229
+        return $groups;
230
+    }
231
+
232
+    /**
233
+     * get a list of all groups
234
+     * @param string $search
235
+     * @param int $limit
236
+     * @param int $offset
237
+     * @return array an array of group names
238
+     *
239
+     * Returns a list with all groups
240
+     */
241
+    public function getGroups($search = '', $limit = null, $offset = null) {
242
+        $query = $this->dbConn->getQueryBuilder();
243
+        $query->select('gid')
244
+            ->from('groups')
245
+            ->orderBy('gid', 'ASC');
246
+
247
+        if ($search !== '') {
248
+            $query->where($query->expr()->iLike('gid', $query->createNamedParameter(
249
+                '%' . $this->dbConn->escapeLikeParameter($search) . '%'
250
+            )));
251
+        }
252
+
253
+        $query->setMaxResults($limit)
254
+            ->setFirstResult($offset);
255
+        $result = $query->execute();
256
+
257
+        $groups = [];
258
+        while ($row = $result->fetch()) {
259
+            $groups[] = $row['gid'];
260
+        }
261
+        $result->closeCursor();
262
+
263
+        return $groups;
264
+    }
265
+
266
+    /**
267
+     * check if a group exists
268
+     * @param string $gid
269
+     * @return bool
270
+     */
271
+    public function groupExists($gid) {
272
+        $this->fixDI();
273
+
274
+        // Check cache first
275
+        if (isset($this->groupCache[$gid])) {
276
+            return true;
277
+        }
278
+
279
+        $qb = $this->dbConn->getQueryBuilder();
280
+        $cursor = $qb->select('gid')
281
+            ->from('groups')
282
+            ->where($qb->expr()->eq('gid', $qb->createNamedParameter($gid)))
283
+            ->execute();
284
+        $result = $cursor->fetch();
285
+        $cursor->closeCursor();
286
+
287
+        if ($result !== false) {
288
+            $this->groupCache[$gid] = $gid;
289
+            return true;
290
+        }
291
+        return false;
292
+    }
293
+
294
+    /**
295
+     * get a list of all users in a group
296
+     * @param string $gid
297
+     * @param string $search
298
+     * @param int $limit
299
+     * @param int $offset
300
+     * @return array an array of user ids
301
+     */
302
+    public function usersInGroup($gid, $search = '', $limit = null, $offset = null) {
303
+        $query = $this->dbConn->getQueryBuilder();
304
+        $query->select('uid')
305
+            ->from('group_user')
306
+            ->where($query->expr()->eq('gid', $query->createNamedParameter($gid)))
307
+            ->orderBy('uid', 'ASC');
308
+
309
+        if ($search !== '') {
310
+            $query->andWhere($query->expr()->like('uid', $query->createNamedParameter(
311
+                '%' . $this->dbConn->escapeLikeParameter($search) . '%'
312
+            )));
313
+        }
314
+
315
+        $query->setMaxResults($limit)
316
+            ->setFirstResult($offset);
317
+        $result = $query->execute();
318
+
319
+        $users = [];
320
+        while ($row = $result->fetch()) {
321
+            $users[] = $row['uid'];
322
+        }
323
+        $result->closeCursor();
324
+
325
+        return $users;
326
+    }
327
+
328
+    /**
329
+     * get the number of all users matching the search string in a group
330
+     * @param string $gid
331
+     * @param string $search
332
+     * @return int|false
333
+     */
334
+    public function countUsersInGroup($gid, $search = '') {
335
+        $query = $this->dbConn->getQueryBuilder();
336
+        $query->selectAlias($query->createFunction('COUNT(*)'), 'num_users')
337
+            ->from('group_user')
338
+            ->where($query->expr()->eq('gid', $query->createNamedParameter($gid)))
339
+            ->orderBy('uid', 'ASC');
340
+
341
+        if ($search !== '') {
342
+            $query->andWhere($query->expr()->like('uid', $query->createNamedParameter(
343
+                '%' . $this->dbConn->escapeLikeParameter($search) . '%'
344
+            )));
345
+        }
346
+
347
+        $result = $query->execute();
348
+        $count = $result->fetchColumn();
349
+        $result->closeCursor();
350
+
351
+        if ($count !== false) {
352
+            $count = (int)$count;
353
+        }
354
+        return $count;
355
+    }
356 356
 
357 357
 }
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 	 * Tries to create a new group. If the group name already exists, false will
80 80
 	 * be returned.
81 81
 	 */
82
-	public function createGroup( $gid ) {
82
+	public function createGroup($gid) {
83 83
 		$this->fixDI();
84 84
 
85 85
 		// Add group
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 	 *
101 101
 	 * Deletes a group and removes it from the group_user-table
102 102
 	 */
103
-	public function deleteGroup( $gid ) {
103
+	public function deleteGroup($gid) {
104 104
 		$this->fixDI();
105 105
 
106 106
 		// Delete the group
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 	 *
136 136
 	 * Checks whether the user is member of a group or not.
137 137
 	 */
138
-	public function inGroup( $uid, $gid ) {
138
+	public function inGroup($uid, $gid) {
139 139
 		$this->fixDI();
140 140
 
141 141
 		// check
@@ -160,18 +160,18 @@  discard block
 block discarded – undo
160 160
 	 *
161 161
 	 * Adds a user to a group.
162 162
 	 */
163
-	public function addToGroup( $uid, $gid ) {
163
+	public function addToGroup($uid, $gid) {
164 164
 		$this->fixDI();
165 165
 
166 166
 		// No duplicate entries!
167
-		if( !$this->inGroup( $uid, $gid )) {
167
+		if (!$this->inGroup($uid, $gid)) {
168 168
 			$qb = $this->dbConn->getQueryBuilder();
169 169
 			$qb->insert('group_user')
170 170
 				->setValue('uid', $qb->createNamedParameter($uid))
171 171
 				->setValue('gid', $qb->createNamedParameter($gid))
172 172
 				->execute();
173 173
 			return true;
174
-		}else{
174
+		} else {
175 175
 			return false;
176 176
 		}
177 177
 	}
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
 	 *
185 185
 	 * removes the user from a group.
186 186
 	 */
187
-	public function removeFromGroup( $uid, $gid ) {
187
+	public function removeFromGroup($uid, $gid) {
188 188
 		$this->fixDI();
189 189
 
190 190
 		$qb = $this->dbConn->getQueryBuilder();
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
 	 * This function fetches all groups a user belongs to. It does not check
205 205
 	 * if the user exists at all.
206 206
 	 */
207
-	public function getUserGroups( $uid ) {
207
+	public function getUserGroups($uid) {
208 208
 		//guests has empty or null $uid
209 209
 		if ($uid === null || $uid === '') {
210 210
 			return [];
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
 			->execute();
221 221
 
222 222
 		$groups = [];
223
-		while( $row = $cursor->fetch()) {
223
+		while ($row = $cursor->fetch()) {
224 224
 			$groups[] = $row['gid'];
225 225
 			$this->groupCache[$row['gid']] = $row['gid'];
226 226
 		}
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
 
247 247
 		if ($search !== '') {
248 248
 			$query->where($query->expr()->iLike('gid', $query->createNamedParameter(
249
-				'%' . $this->dbConn->escapeLikeParameter($search) . '%'
249
+				'%'.$this->dbConn->escapeLikeParameter($search).'%'
250 250
 			)));
251 251
 		}
252 252
 
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
 
309 309
 		if ($search !== '') {
310 310
 			$query->andWhere($query->expr()->like('uid', $query->createNamedParameter(
311
-				'%' . $this->dbConn->escapeLikeParameter($search) . '%'
311
+				'%'.$this->dbConn->escapeLikeParameter($search).'%'
312 312
 			)));
313 313
 		}
314 314
 
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
 
341 341
 		if ($search !== '') {
342 342
 			$query->andWhere($query->expr()->like('uid', $query->createNamedParameter(
343
-				'%' . $this->dbConn->escapeLikeParameter($search) . '%'
343
+				'%'.$this->dbConn->escapeLikeParameter($search).'%'
344 344
 			)));
345 345
 		}
346 346
 
@@ -349,7 +349,7 @@  discard block
 block discarded – undo
349 349
 		$result->closeCursor();
350 350
 
351 351
 		if ($count !== false) {
352
-			$count = (int)$count;
352
+			$count = (int) $count;
353 353
 		}
354 354
 		return $count;
355 355
 	}
Please login to merge, or discard this patch.