Passed
Push — develop ( 319bd8...330c7a )
by Neill
16:41 queued 15s
created
neon/phoebe/controllers/common/PhoebeController.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@
 block discarded – undo
52 52
 	 * @param string $type the phoebe class type
53 53
 	 * @return \neon\core\form\Form
54 54
 	 */
55
-	protected function getPhoebeForm($type, &$isNewForm=null, $addExtras=true, $builder=false)
55
+	protected function getPhoebeForm($type, &$isNewForm = null, $addExtras = true, $builder = false)
56 56
 	{
57 57
 		$form = null;
58 58
 		$isNewForm = false;
Please login to merge, or discard this patch.
Braces   +21 added lines, -14 removed lines patch added patch discarded remove patch
@@ -61,8 +61,9 @@  discard block
 block discarded – undo
61 61
 			$class = $this->getClass($type);
62 62
 			if ($builder) {
63 63
 				$definition = $class->getClassBuilderDefinition();
64
-			} else
65
-				$definition = $class->getClassFormDefinition();
64
+			} else {
65
+							$definition = $class->getClassFormDefinition();
66
+			}
66 67
 			$fieldCount = count($definition['fields']);
67 68
 			$isNewForm = count($definition) == 0 ? true : false;
68 69
 			$form = new \neon\core\form\Form($definition);
@@ -114,8 +115,9 @@  discard block
 block discarded – undo
114 115
 	protected function getBuilderDefinition($classType)
115 116
 	{
116 117
 		$class = null;
117
-		if ($classType)
118
-			$class = $this->getClass($classType);
118
+		if ($classType) {
119
+					$class = $this->getClass($classType);
120
+		}
119 121
 		return $class ? $class->getClassBuilderDefinition() : [];
120 122
 	}
121 123
 
@@ -127,8 +129,9 @@  discard block
 block discarded – undo
127 129
 	protected function getClassDefinition($classType)
128 130
 	{
129 131
 		$class = null;
130
-		if ($classType)
131
-			$class = $this->getClass($classType);
132
+		if ($classType) {
133
+					$class = $this->getClass($classType);
134
+		}
132 135
 		return $class ? $class->definition : [];
133 136
 	}
134 137
 
@@ -151,8 +154,9 @@  discard block
 block discarded – undo
151 154
 	protected function getObject($id)
152 155
 	{
153 156
 		$object = $this->phoebe()->getObject($id);
154
-		if (!$object)
155
-			throw new \yii\web\HttpException(404);
157
+		if (!$object) {
158
+					throw new \yii\web\HttpException(404);
159
+		}
156 160
 		return $object;
157 161
 	}
158 162
 
@@ -164,8 +168,9 @@  discard block
 block discarded – undo
164 168
 	protected function deleteObject($id)
165 169
 	{
166 170
 		$object = $this->phoebe()->getObject($id);
167
-		if ($object)
168
-			return $object->deleteObject();
171
+		if ($object) {
172
+					return $object->deleteObject();
173
+		}
169 174
 		return null;
170 175
 	}
171 176
 
@@ -177,8 +182,9 @@  discard block
 block discarded – undo
177 182
 	protected function undeleteObject($id)
178 183
 	{
179 184
 		$object = $this->phoebe()->getObject($id);
180
-		if ($object)
181
-			return $object->undeleteObject();
185
+		if ($object) {
186
+					return $object->undeleteObject();
187
+		}
182 188
 		return null;
183 189
 	}
184 190
 
@@ -190,8 +196,9 @@  discard block
 block discarded – undo
190 196
 	protected function destroyObject($id)
191 197
 	{
192 198
 		$object = $this->phoebe()->getObject($id);
193
-		if ($object)
194
-			return $object->destroyObject();
199
+		if ($object) {
200
+					return $object->destroyObject();
201
+		}
195 202
 		return null;
196 203
 	}
197 204
 }
Please login to merge, or discard this patch.
neon/phoebe/controllers/common/PhoebeValidator.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@
 block discarded – undo
7 7
  */
8 8
 class PhoebeValidator
9 9
 {
10
-	public static function validateForm($phoebeType, $classType, $name=null)
10
+	public static function validateForm($phoebeType, $classType, $name = null)
11 11
 	{
12 12
 		// get hold of the form
13 13
 		$form = neon('phoebe')->getForm($phoebeType, $classType, []);
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,8 +11,9 @@
 block discarded – undo
11 11
 	{
12 12
 		// get hold of the form
13 13
 		$form = neon('phoebe')->getForm($phoebeType, $classType, []);
14
-		if ($name)
15
-			$form->setName($name);
14
+		if ($name) {
15
+					$form->setName($name);
16
+		}
16 17
 		return $form->ajaxValidation();
17 18
 	}
18 19
 }
Please login to merge, or discard this patch.
neon/phoebe/builders/database/assets/FormBuilderAsset.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@
 block discarded – undo
12 12
 
13 13
 class FormBuilderAsset extends \yii\web\AssetBundle
14 14
 {
15
-	public $sourcePath = __DIR__ . '/publish';
15
+	public $sourcePath = __DIR__.'/publish';
16 16
 
17 17
 	public $js = [
18 18
 		'store.js',
Please login to merge, or discard this patch.
neon/phoebe/builders/appforms/assets/AppFormBuilderAsset.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
 
14 14
 class AppFormBuilderAsset extends \yii\web\AssetBundle
15 15
 {
16
-	public $sourcePath = __DIR__ . '/publish';
16
+	public $sourcePath = __DIR__.'/publish';
17 17
 
18 18
 	public $js = [
19 19
 		'manifest.js',
Please login to merge, or discard this patch.
neon/phoebe/migrations/m171011_143735_forms_phoebe.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -7,11 +7,11 @@
 block discarded – undo
7 7
  */
8 8
 class m171011_143735_forms_phoebe extends Migration
9 9
 {
10
-    public function safeUp()
11
-    {
12
-    }
10
+	public function safeUp()
11
+	{
12
+	}
13 13
 
14
-    public function safeDown()
15
-    {
16
-    }
14
+	public function safeDown()
15
+	{
16
+	}
17 17
 }
Please login to merge, or discard this patch.
neon/phoebe/App.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 	/**
92 92
 	 * @inheritdoc
93 93
 	 */
94
-	public function getDataMap($key, $query='', $filters=[], $fields=[], $start=0, $length=100)
94
+	public function getDataMap($key, $query = '', $filters = [], $fields = [], $start = 0, $length = 100)
95 95
 	{
96 96
 		// convert generic form builder filters to phoebe class ones
97 97
 		$filters = Arr::replaceKeys($filters, ['uuid'=> 'class_type']);
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
 	 *   that you want to display and in what order
174 174
 	 * @return array
175 175
 	 */
176
-	public function getFormDefinition($phoebeType, $classType, array $fields=[])
176
+	public function getFormDefinition($phoebeType, $classType, array $fields = [])
177 177
 	{
178 178
 		$cacheKey = md5(serialize(func_get_args()));
179 179
 		return neon()->cacheArray->getOrSet($cacheKey, function() use ($classType, $phoebeType, $fields) {
@@ -426,7 +426,7 @@  discard block
 block discarded – undo
426 426
 	 * @return bool - returns true if saved correctly or the set of errors if the
427 427
 	 *   form couldn't validate
428 428
 	 */
429
-	public function saveForm($phoebeType, $classType, $form=null, $formName=null, $metaInfo=null, &$uuid=null, &$changeLogUuids=[])
429
+	public function saveForm($phoebeType, $classType, $form = null, $formName = null, $metaInfo = null, &$uuid = null, &$changeLogUuids = [])
430 430
 	{
431 431
 		$changeLogUuids = [];
432 432
 		if (!$form) {
@@ -509,7 +509,7 @@  discard block
 block discarded – undo
509 509
 					$itemKey = substr($key, strlen($this->formMetaDataSourceString));
510 510
 					if (empty($meta['dataSources'][$itemKey]))
511 511
 						$meta['dataSources'][$itemKey] = $v;
512
-				} else if ($key==$this->formMetaReturnUrlString && empty($meta['returnUrl'])) {
512
+				} else if ($key == $this->formMetaReturnUrlString && empty($meta['returnUrl'])) {
513 513
 					$meta['returnUrl'] = $v;
514 514
 				}
515 515
 			}
Please login to merge, or discard this patch.
Braces   +60 added lines, -40 removed lines patch added patch discarded remove patch
@@ -252,16 +252,18 @@  discard block
 block discarded – undo
252 252
 		$formDefinition = [];
253 253
 		if (!empty($options['uuid'])) {
254 254
 			$object = $phoebe->getObject($options['uuid']);
255
-			if (!$object)
256
-				throw new \RuntimeException('The requested form object was not found. Uuid='.$options['uuid']);
255
+			if (!$object) {
256
+							throw new \RuntimeException('The requested form object was not found. Uuid='.$options['uuid']);
257
+			}
257 258
 			$class = $object->getIPhoebeClass();
258 259
 			$formDefinition = $class->getClassFormDefinition($fields);
259 260
 		} else {
260 261
 			// otherwise get a clean class
261 262
 			if ($classType) {
262 263
 				$formDefinition = $this->getFormDefinition($phoebeType, $classType, $fields);
263
-				if (!count($formDefinition))
264
-					throw new \RuntimeException('The requested form type was not found. Type='.$classType);
264
+				if (!count($formDefinition)) {
265
+									throw new \RuntimeException('The requested form type was not found. Type='.$classType);
266
+				}
265 267
 			}
266 268
 		}
267 269
 		$fieldCount = count($formDefinition['fields']);
@@ -269,16 +271,19 @@  discard block
 block discarded – undo
269 271
 
270 272
 
271 273
 		// temporary code to cover problems with differences between appForms and ddsForms
272
-		if ($phoebeType !== 'applicationForm' && !empty($options['initialiseFromDds']))
273
-			throw new \RuntimeException('Only applicationForms work with initialiseFromDds');
274
+		if ($phoebeType !== 'applicationForm' && !empty($options['initialiseFromDds'])) {
275
+					throw new \RuntimeException('Only applicationForms work with initialiseFromDds');
276
+		}
274 277
 
275 278
 		// set the form class
276
-		if (!empty($options['cssClass']))
277
-			$form->setAttributes(['class'=>$options['cssClass']]);
279
+		if (!empty($options['cssClass'])) {
280
+					$form->setAttributes(['class'=>$options['cssClass']]);
281
+		}
278 282
 
279 283
 		// set the form id
280
-		if (!empty($options['id']))
281
-			$form->setId($options['id']);
284
+		if (!empty($options['id'])) {
285
+					$form->setId($options['id']);
286
+		}
282 287
 		$formId = $form->getId();
283 288
 		if ($printOnly) {
284 289
 			$form->printOnly = true;
@@ -289,17 +294,20 @@  discard block
 block discarded – undo
289 294
 		}
290 295
 
291 296
 		// set the forms label - allow clearing of it via empty string
292
-		if (isset($options['label']))
293
-			$form->setLabel($options['label']);
297
+		if (isset($options['label'])) {
298
+					$form->setLabel($options['label']);
299
+		}
294 300
 
295 301
 
296 302
 		// check to see if we are not posting from the client, populate it from the database
297 303
 		// !set the form name before checking data set!
298
-		if (!empty($options['name']))
299
-			$form->setName($options['name']);
304
+		if (!empty($options['name'])) {
305
+					$form->setName($options['name']);
306
+		}
300 307
 		if (!empty($options['initialiseFromDds']) && (!$object || !$object->data)) {
301
-			if (!$object)
302
-				$object = $phoebe->createStubObject($classType);
308
+			if (!$object) {
309
+							$object = $phoebe->createStubObject($classType);
310
+			}
303 311
 			$object->initialiseFromDds($options['initialiseFromDds']);
304 312
 		}
305 313
 		if ($object && !$form->hasRequestData()) {
@@ -307,8 +315,9 @@  discard block
 block discarded – undo
307 315
 		}
308 316
 
309 317
 		if (!($printOnly || $readOnly)) {
310
-			if (!empty($options['uuid']))
311
-				$form->addFieldHidden("{$this->formMetaPrefix}{$this->formMetaUuidString}", ['value'=>$options['uuid']]);
318
+			if (!empty($options['uuid'])) {
319
+							$form->addFieldHidden("{$this->formMetaPrefix}{$this->formMetaUuidString}", ['value'=>$options['uuid']]);
320
+			}
312 321
 
313 322
 			// set any additional data sources
314 323
 			if (!empty($options['dataSources'])) {
@@ -316,8 +325,9 @@  discard block
 block discarded – undo
316 325
 					$form->addFieldHidden("{$this->formMetaPrefix}{$this->formMetaDataSourceString}$key", ['value'=>$value]);
317 326
 					// for dds forms, set the values on the form too for initial display
318 327
 					if ($phoebeType == 'daedalus') {
319
-						if ($form->hasField($key))
320
-							$form->getField($key)->setValue($value);
328
+						if ($form->hasField($key)) {
329
+													$form->getField($key)->setValue($value);
330
+						}
321 331
 					}
322 332
 				}
323 333
 			}
@@ -328,8 +338,9 @@  discard block
 block discarded – undo
328 338
 			if (!empty($options['mapFilters'])) {
329 339
 				foreach ($options['mapFilters'] as $key=>$filters) {
330 340
 					$f = $form->getField($key);
331
-					if ($f && isset($f->dataMapFilters))
332
-						$f->dataMapFilters = $filters;
341
+					if ($f && isset($f->dataMapFilters)) {
342
+											$f->dataMapFilters = $filters;
343
+					}
333 344
 				}
334 345
 			}
335 346
 
@@ -339,8 +350,9 @@  discard block
 block discarded – undo
339 350
 			if (!empty($options['mapFields'])) {
340 351
 				foreach ($options['mapFields'] as $key=>$mapFields) {
341 352
 					$f = $form->getField($key);
342
-					if ($f && isset($f->dataMapFields))
343
-						$f->dataMapFields = $mapFields;
353
+					if ($f && isset($f->dataMapFields)) {
354
+											$f->dataMapFields = $mapFields;
355
+					}
344 356
 				}
345 357
 			}
346 358
 
@@ -365,20 +377,24 @@  discard block
 block discarded – undo
365 377
 			}
366 378
 
367 379
 			// set the forms action
368
-			if (!empty($options['action']))
369
-				$form->setAction($options['action']);
380
+			if (!empty($options['action'])) {
381
+							$form->setAction($options['action']);
382
+			}
370 383
 
371 384
 			// set whether or not ajax validation is required
372
-			if (isset($options['enableAjaxValidation']))
373
-				$form->enableAjaxValidation = (boolean) $options['enableAjaxValidation'];
385
+			if (isset($options['enableAjaxValidation'])) {
386
+							$form->enableAjaxValidation = (boolean) $options['enableAjaxValidation'];
387
+			}
374 388
 
375 389
 			// set whether or not ajax submission is required
376
-			if (isset($options['enableAjaxSubmission']))
377
-				$form->enableAjaxSubmission = (boolean) $options['enableAjaxSubmission'];
390
+			if (isset($options['enableAjaxSubmission'])) {
391
+							$form->enableAjaxSubmission = (boolean) $options['enableAjaxSubmission'];
392
+			}
378 393
 
379 394
 			// set where the form will check itself via ajaxValidation
380
-			if (!empty($options['ajaxValidationUrl']))
381
-				$form->validationUrl = $options['ajaxValidationUrl'];
395
+			if (!empty($options['ajaxValidationUrl'])) {
396
+							$form->validationUrl = $options['ajaxValidationUrl'];
397
+			}
382 398
 
383 399
 			// set where the browser will go to after completion of the form
384 400
 			if (!empty($options['returnUrl'])) {
@@ -438,8 +454,9 @@  discard block
 block discarded – undo
438 454
 			$definition = $this->getFormDefinition($phoebeType, $classType);
439 455
 			$form = new \neon\core\form\Form($definition);
440 456
 		}
441
-		if (!empty($formName))
442
-			$form->setName($formName);
457
+		if (!empty($formName)) {
458
+					$form->setName($formName);
459
+		}
443 460
 		if ($form->processRequest()) {
444 461
 			$data = $form->getData();
445 462
 			// prevent multiple renders resulting in multiple saves of the form
@@ -461,13 +478,15 @@  discard block
 block discarded – undo
461 478
 					$changeLogUuids['add'] = $object->getChangeLogUuid();
462 479
 				}
463 480
 				$uuid = $object->uuid;
464
-				if (!empty($meta['dataSources']))
465
-					$object->setDataSources($meta['dataSources']);
481
+				if (!empty($meta['dataSources'])) {
482
+									$object->setDataSources($meta['dataSources']);
483
+				}
466 484
 				if ($object->editObject($data) === true) {
467 485
 					$alreadySubmitted[$submittedCheck] = $uuid;
468 486
 					$changeLogUuids['edit'] = $object->getChangeLogUuid();
469
-					if (!empty($meta['returnUrl']))
470
-						neon()->response->redirect(html_entity_decode($meta['returnUrl']));
487
+					if (!empty($meta['returnUrl'])) {
488
+											neon()->response->redirect(html_entity_decode($meta['returnUrl']));
489
+					}
471 490
 					return true;
472 491
 				}
473 492
 			} else {
@@ -512,8 +531,9 @@  discard block
 block discarded – undo
512 531
 					$meta['uuid'] = $v;
513 532
 				} else if (strpos($key, $this->formMetaDataSourceString) === 0) {
514 533
 					$itemKey = substr($key, strlen($this->formMetaDataSourceString));
515
-					if (empty($meta['dataSources'][$itemKey]))
516
-						$meta['dataSources'][$itemKey] = $v;
534
+					if (empty($meta['dataSources'][$itemKey])) {
535
+											$meta['dataSources'][$itemKey] = $v;
536
+					}
517 537
 				} else if ($key==$this->formMetaReturnUrlString && empty($meta['returnUrl'])) {
518 538
 					$meta['returnUrl'] = $v;
519 539
 				}
Please login to merge, or discard this patch.
neon/user/interfaces/iUser.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -80,5 +80,5 @@
 block discarded – undo
80 80
 	 * @param string $role
81 81
 	 * @return null | string  the url if found
82 82
 	 */
83
-	public function getHomeUrl($role=null);
83
+	public function getHomeUrl($role = null);
84 84
 }
85 85
\ No newline at end of file
Please login to merge, or discard this patch.
neon/user/interfaces/IUserManagement.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 	 * @return array  users as
38 38
 	 *   [['uuid'=>'username']...]
39 39
 	 */
40
-	public function listUsers(Iterator &$iterator=null);
40
+	public function listUsers(Iterator &$iterator = null);
41 41
 
42 42
 	/**
43 43
 	 * Find a set of users based on a partial search string
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 	 * @return array  users as
48 48
 	 *   [['uuid'=>'username']...]
49 49
 	 */
50
-	public function searchUsers($search, Iterator &$iterator=null);
50
+	public function searchUsers($search, Iterator &$iterator = null);
51 51
 
52 52
 	/**
53 53
 	 * Create a new User
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 	 *   calling this must also be a superuser
60 60
 	 * @return string  - the users uuid
61 61
 	 */
62
-	public function addUser($username, $email, $password, $roles=[], $superuser=false);
62
+	public function addUser($username, $email, $password, $roles = [], $superuser = false);
63 63
 
64 64
 	/**
65 65
 	 * Get hold of an User given the user uuid
Please login to merge, or discard this patch.
neon/user/models/User.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 	/**
166 166
 	 * @inheritdoc
167 167
 	 */
168
-	public function getHomeUrl($role=null)
168
+	public function getHomeUrl($role = null)
169 169
 	{
170 170
 		$userRoles = $this->getRoles();
171 171
 		$availableRoles = neon('user')->getRoles(true);
@@ -333,14 +333,14 @@  discard block
 block discarded – undo
333 333
 	 * @see getUserListUncached for details
334 334
 	 * @return array
335 335
 	 */
336
-	public static function getUserList($query='', $filters=[], $fields=[], $start=0, $length=100)
336
+	public static function getUserList($query = '', $filters = [], $fields = [], $start = 0, $length = 100)
337 337
 	{
338 338
 		// because we need to cache according to the args we cannot store
339 339
 		// results in cache rather cacheArray. This is so we can clear cache
340 340
 		// appropriately in other calls such as edit and delete. Also user
341 341
 		// information should not be available in cached files
342 342
 		return neon()->cacheArray->getOrSet(
343
-			[static::CACHE_KEY_USER_LIST,func_get_args()],
343
+			[static::CACHE_KEY_USER_LIST, func_get_args()],
344 344
 			function() use ($query, $filters, $fields, $start, $length) {
345 345
 				return self::getUserListUncached($query, $filters, $fields, $start, $length);
346 346
 			}
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
 	 * @param int $length - the total number of rows to return
360 360
 	 * @return array
361 361
 	 */
362
-	public static function getUserListUncached($query='',$filters=[], $fields=[], $start=0, $length=100)
362
+	public static function getUserListUncached($query = '', $filters = [], $fields = [], $start = 0, $length = 100)
363 363
 	{
364 364
 		$q = self::find()->select(array_merge(['uuid', 'username', 'email'], $fields));
365 365
 		if ($q !== '')
@@ -384,7 +384,7 @@  discard block
 block discarded – undo
384 384
 	{
385 385
 		return collect($userRows)->mapWithKeys(function($row, $key) use($fields) {
386 386
 			if (empty($fields))
387
-				return [$row['uuid'] => $row['username'] ? $row['username'] . ' - ' . $row['email'] : $row['email']];
387
+				return [$row['uuid'] => $row['username'] ? $row['username'].' - '.$row['email'] : $row['email']];
388 388
 			return [$row['uuid'] => $row];
389 389
 		})->all();
390 390
 	}
@@ -504,7 +504,7 @@  discard block
 block discarded – undo
504 504
 	 */
505 505
 	public function generatePasswordResetToken()
506 506
 	{
507
-		$this->password_reset_token = neon()->security->generateRandomString() . '_' . time();
507
+		$this->password_reset_token = neon()->security->generateRandomString().'_'.time();
508 508
 	}
509 509
 
510 510
 	/**
@@ -621,7 +621,7 @@  discard block
 block discarded – undo
621 621
 	/**
622 622
 	 * @inheritDoc
623 623
 	 */
624
-	public function getImageUrl($size=40)
624
+	public function getImageUrl($size = 40)
625 625
 	{
626 626
 		return Html::gravatar($this->email, $size, 'mm', 'g');
627 627
 	}
Please login to merge, or discard this patch.
Braces   +30 added lines, -20 removed lines patch added patch discarded remove patch
@@ -125,8 +125,9 @@  discard block
 block discarded – undo
125 125
 	 */
126 126
 	public function getRoles()
127 127
 	{
128
-		if (!isset(static::$_userRoles[$this->id]))
129
-			static::$_userRoles[$this->id] = array_keys(neon()->authManager->getRolesByUser($this->id));
128
+		if (!isset(static::$_userRoles[$this->id])) {
129
+					static::$_userRoles[$this->id] = array_keys(neon()->authManager->getRolesByUser($this->id));
130
+		}
130 131
 		return is_array(static::$_userRoles[$this->id]) ? static::$_userRoles[$this->id] : [];
131 132
 	}
132 133
 
@@ -139,8 +140,9 @@  discard block
 block discarded – undo
139 140
 		$authManager->revokeAll($this->id);
140 141
 		foreach ($roles as $role) {
141 142
 			$r = $authManager->getRole($role);
142
-			if ($r)
143
-				$authManager->assign($r, $this->id);
143
+			if ($r) {
144
+							$authManager->assign($r, $this->id);
145
+			}
144 146
 		}
145 147
 		unset(static::$_userRoles[$this->id]);
146 148
 	}
@@ -172,12 +174,14 @@  discard block
 block discarded – undo
172 174
 
173 175
 		// searching in a specific role?
174 176
 		if (!empty($role)) {
175
-			if (isset($availableRoles[$role]['homeUrl']))
176
-				return $availableRoles[$role]['homeUrl'];
177
+			if (isset($availableRoles[$role]['homeUrl'])) {
178
+							return $availableRoles[$role]['homeUrl'];
179
+			}
177 180
 		} else { // or finding any one?
178 181
 			foreach ($userRoles as $role) {
179
-				if (isset($availableRoles[$role]['homeUrl']))
180
-					return $availableRoles[$role]['homeUrl'];
182
+				if (isset($availableRoles[$role]['homeUrl'])) {
183
+									return $availableRoles[$role]['homeUrl'];
184
+				}
181 185
 
182 186
 			}
183 187
 		}
@@ -204,8 +208,9 @@  discard block
 block discarded – undo
204 208
 	public static function findIdentity($id)
205 209
 	{
206 210
 		// The id must be a uuid64
207
-		if (!Hash::isUuid64($id))
208
-			return null;
211
+		if (!Hash::isUuid64($id)) {
212
+					return null;
213
+		}
209 214
 		// The string conversion here is important to ensure the id is correctly quoted as a string
210 215
 		// otherwise if the $id is a number it will match uuid's that start with that number!
211 216
 		return self::findOne(['uuid' => (string) $id, 'status' => self::STATUS_ACTIVE]);
@@ -231,8 +236,9 @@  discard block
 block discarded – undo
231 236
 	public static function findIdentityByInviteToken($token)
232 237
 	{
233 238
 		$invite = UserInvite::findInviteByInviteToken($token);
234
-		if (!$invite)
235
-			return null;
239
+		if (!$invite) {
240
+					return null;
241
+		}
236 242
 		return User::findOne(['uuid' => $invite->user_id, 'status' => [User::STATUS_PENDING]]);
237 243
 	}
238 244
 
@@ -362,10 +368,12 @@  discard block
 block discarded – undo
362 368
 	public static function getUserListUncached($query='',$filters=[], $fields=[], $start=0, $length=100)
363 369
 	{
364 370
 		$q = self::find()->select(array_merge(['uuid', 'username', 'email'], $fields));
365
-		if ($q !== '')
366
-			$q->where(['or', ['like', 'username', $query], ['like', 'email', $query]]);
367
-		if (!empty($filters))
368
-			$q->andWhere($filters);
371
+		if ($q !== '') {
372
+					$q->where(['or', ['like', 'username', $query], ['like', 'email', $query]]);
373
+		}
374
+		if (!empty($filters)) {
375
+					$q->andWhere($filters);
376
+		}
369 377
 		$q->offset($start)
370 378
 			->limit($length)
371 379
 			->orderBy(['username' => SORT_ASC, 'email' => SORT_ASC])
@@ -383,8 +391,9 @@  discard block
 block discarded – undo
383 391
 	public static function formatDataMapItems($userRows, $fields)
384 392
 	{
385 393
 		return collect($userRows)->mapWithKeys(function($row, $key) use($fields) {
386
-			if (empty($fields))
387
-				return [$row['uuid'] => $row['username'] ? $row['username'] . ' - ' . $row['email'] : $row['email']];
394
+			if (empty($fields)) {
395
+							return [$row['uuid'] => $row['username'] ? $row['username'] . ' - ' . $row['email'] : $row['email']];
396
+			}
388 397
 			return [$row['uuid'] => $row];
389 398
 		})->all();
390 399
 	}
@@ -538,8 +547,9 @@  discard block
 block discarded – undo
538 547
 	{
539 548
 		// remove any caches and authorisations against the user
540 549
 		neon()->cacheArray->delete(static::CACHE_KEY_USER_LIST);
541
-		if ($this->id)
542
-			neon()->authManager->revokeAll($this->id);
550
+		if ($this->id) {
551
+					neon()->authManager->revokeAll($this->id);
552
+		}
543 553
 		return parent::beforeDelete();
544 554
 	}
545 555
 
Please login to merge, or discard this patch.