Scrutinizer GitHub App not installed

We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.

Install GitHub App

Passed
Push — master ( 287493...da8ddf )
by Dan
52s queued 13s
created
lib/Default/AbstractSmrPlayer.class.inc 1 patch
Braces   +238 added lines, -163 removed lines patch added patch discarded remove patch
@@ -78,8 +78,9 @@  discard block
 block discarded – undo
78 78
 		return $this->getNewbieTurns()>0;
79 79
 	}
80 80
 	public function setNewbieTurns($newbieTurns) {
81
-		if($this->newbieTurns == $newbieTurns)
82
-			return;
81
+		if($this->newbieTurns == $newbieTurns) {
82
+					return;
83
+		}
83 84
 		$this->newbieTurns=$newbieTurns;
84 85
 		$this->hasChanged=true;
85 86
 	}
@@ -89,8 +90,9 @@  discard block
 block discarded – undo
89 90
 	}
90 91
 
91 92
 	public function setShipTypeID($shipID) {
92
-		if($this->shipID == $shipID)
93
-			return;
93
+		if($this->shipID == $shipID) {
94
+					return;
95
+		}
94 96
 		$this->shipID=$shipID;
95 97
 		$this->hasChanged=true;
96 98
 	}
@@ -206,8 +208,9 @@  discard block
 block discarded – undo
206 208
 		}
207 209
 
208 210
 		$ship = $this->getShip();
209
-		if ($ship->hasIllegalGoods())
210
-			return false;
211
+		if ($ship->hasIllegalGoods()) {
212
+					return false;
213
+		}
211 214
 
212 215
 		if ($ship->getAttackRating() <= $this->getSafeAttackRating()) {
213 216
 			foreach($sector->getFedRaceIDs() as $fedRaceID) {
@@ -248,8 +251,9 @@  discard block
 block discarded – undo
248 251
 	}
249 252
 
250 253
 	public function setDead($bool) {
251
-		if($this->dead == $bool)
252
-			return;
254
+		if($this->dead == $bool) {
255
+					return;
256
+		}
253 257
 		$this->dead=$bool;
254 258
 		$this->hasChanged=true;
255 259
 	}
@@ -259,14 +263,16 @@  discard block
 block discarded – undo
259 263
 	}
260 264
 
261 265
 	public function increaseKills($kills) {
262
-		if($kills < 0)
263
-			throw new Exception('Trying to increase negative kills.');
266
+		if($kills < 0) {
267
+					throw new Exception('Trying to increase negative kills.');
268
+		}
264 269
 		$this->setKills($this->kills+$kills);
265 270
 	}
266 271
 
267 272
 	public function setKills($kills) {
268
-		if($this->kills == $kills)
269
-			return;
273
+		if($this->kills == $kills) {
274
+					return;
275
+		}
270 276
 		$this->kills=$kills;
271 277
 		$this->hasChanged=true;
272 278
 	}
@@ -276,14 +282,16 @@  discard block
 block discarded – undo
276 282
 	}
277 283
 
278 284
 	public function increaseDeaths($deaths) {
279
-		if($deaths < 0)
280
-			throw new Exception('Trying to increase negative deaths.');
285
+		if($deaths < 0) {
286
+					throw new Exception('Trying to increase negative deaths.');
287
+		}
281 288
 		$this->setDeaths($this->getDeaths()+$deaths);
282 289
 	}
283 290
 
284 291
 	public function setDeaths($deaths) {
285
-		if($this->deaths == $deaths)
286
-			return;
292
+		if($this->deaths == $deaths) {
293
+					return;
294
+		}
287 295
 		$this->deaths = $deaths;
288 296
 		$this->hasChanged=true;
289 297
 	}
@@ -305,24 +313,29 @@  discard block
 block discarded – undo
305 313
 	}
306 314
 
307 315
 	public function increaseAlignment($align) {
308
-		if($align < 0)
309
-			throw new Exception('Trying to increase negative align.');
310
-		if($align == 0)
311
-			return;
316
+		if($align < 0) {
317
+					throw new Exception('Trying to increase negative align.');
318
+		}
319
+		if($align == 0) {
320
+					return;
321
+		}
312 322
 		$align += $this->alignment;
313 323
 		$this->setAlignment($align);
314 324
 	}
315 325
 	public function decreaseAlignment($align) {
316
-		if($align < 0)
317
-			throw new Exception('Trying to decrease negative align.');
318
-		if($align == 0)
319
-			return;
326
+		if($align < 0) {
327
+					throw new Exception('Trying to decrease negative align.');
328
+		}
329
+		if($align == 0) {
330
+					return;
331
+		}
320 332
 		$align = $this->alignment - $align;
321 333
 		$this->setAlignment($align);
322 334
 	}
323 335
 	public function setAlignment($align) {
324
-		if($this->alignment == $align)
325
-			return;
336
+		if($this->alignment == $align) {
337
+					return;
338
+		}
326 339
 		$this->alignment = $align;
327 340
 		$this->hasChanged=true;
328 341
 	}
@@ -336,8 +349,9 @@  discard block
 block discarded – undo
336 349
 	}
337 350
 
338 351
 	public function getNextLevelPercentAcquired() {
339
-		if($this->getNextLevelExperience() == $this->getThisLevelExperience())
340
-			return 100;
352
+		if($this->getNextLevelExperience() == $this->getThisLevelExperience()) {
353
+					return 100;
354
+		}
341 355
 		return max(0,min(100,round(($this->getExperience() - $this->getThisLevelExperience()) / ($this->getNextLevelExperience() - $this->getThisLevelExperience())*100)));
342 356
 	}
343 357
 
@@ -347,8 +361,10 @@  discard block
 block discarded – undo
347 361
 
348 362
 	public function getNextLevelExperience() {
349 363
 		$LEVELS_REQUIREMENTS = Globals::getLevelRequirements();
350
-		if(!isset($LEVELS_REQUIREMENTS[$this->getLevelID()+1]))
351
-			return $this->getThisLevelExperience(); //Return current level experience if on last level.
364
+		if(!isset($LEVELS_REQUIREMENTS[$this->getLevelID()+1])) {
365
+					return $this->getThisLevelExperience();
366
+		}
367
+		//Return current level experience if on last level.
352 368
 		return $LEVELS_REQUIREMENTS[$this->getLevelID()+1]['Requirement'];
353 369
 	}
354 370
 
@@ -358,12 +374,15 @@  discard block
 block discarded – undo
358 374
 	}
359 375
 
360 376
 	public function setExperience($experience) {
361
-		if($this->experience == $experience)
362
-			return;
363
-		if($experience<MIN_EXPERIENCE)
364
-			$experience = MIN_EXPERIENCE;
365
-		if($experience>MAX_EXPERIENCE)
366
-			$experience = MAX_EXPERIENCE;
377
+		if($this->experience == $experience) {
378
+					return;
379
+		}
380
+		if($experience<MIN_EXPERIENCE) {
381
+					$experience = MIN_EXPERIENCE;
382
+		}
383
+		if($experience>MAX_EXPERIENCE) {
384
+					$experience = MAX_EXPERIENCE;
385
+		}
367 386
 		$this->experience = $experience;
368 387
 		$this->hasChanged=true;
369 388
 
@@ -373,46 +392,57 @@  discard block
 block discarded – undo
373 392
 	}
374 393
 
375 394
 	public function increaseCredits($credits) {
376
-		if($credits < 0)
377
-			throw new Exception('Trying to increase negative credits.');
378
-		if($credits == 0)
379
-			return;
395
+		if($credits < 0) {
396
+					throw new Exception('Trying to increase negative credits.');
397
+		}
398
+		if($credits == 0) {
399
+					return;
400
+		}
380 401
 		$credits += $this->credits;
381 402
 		$this->setCredits($credits);
382 403
 	}
383 404
 	public function decreaseCredits($credits) {
384
-		if($credits < 0)
385
-			throw new Exception('Trying to decrease negative credits.');
386
-		if($credits == 0)
387
-			return;
405
+		if($credits < 0) {
406
+					throw new Exception('Trying to decrease negative credits.');
407
+		}
408
+		if($credits == 0) {
409
+					return;
410
+		}
388 411
 		$credits = $this->credits - $credits;
389 412
 		$this->setCredits($credits);
390 413
 	}
391 414
 	public function setCredits($credits) {
392
-		if($this->credits == $credits)
393
-			return;
394
-		if($credits < 0)
395
-			throw new Exception('Trying to set negative credits.');
396
-		if($credits > MAX_MONEY)
397
-			$credits = MAX_MONEY;
415
+		if($this->credits == $credits) {
416
+					return;
417
+		}
418
+		if($credits < 0) {
419
+					throw new Exception('Trying to set negative credits.');
420
+		}
421
+		if($credits > MAX_MONEY) {
422
+					$credits = MAX_MONEY;
423
+		}
398 424
 		$this->credits = $credits;
399 425
 		$this->hasChanged=true;
400 426
 	}
401 427
 
402 428
 	public function increaseExperience($experience) {
403
-		if($experience < 0)
404
-			throw new Exception('Trying to increase negative experience.');
405
-		if($experience == 0)
406
-			return;
429
+		if($experience < 0) {
430
+					throw new Exception('Trying to increase negative experience.');
431
+		}
432
+		if($experience == 0) {
433
+					return;
434
+		}
407 435
 		$newExperience = $this->experience + $experience;
408 436
 		$this->setExperience($newExperience);
409 437
 		$this->increaseHOF($experience,array('Experience','Total','Gain'), HOF_PUBLIC);
410 438
 	}
411 439
 	public function decreaseExperience($experience) {
412
-		if($experience < 0)
413
-			throw new Exception('Trying to decrease negative experience.');
414
-		if($experience == 0)
415
-			return;
440
+		if($experience < 0) {
441
+					throw new Exception('Trying to decrease negative experience.');
442
+		}
443
+		if($experience == 0) {
444
+					return;
445
+		}
416 446
 		$newExperience = $this->experience - $experience;
417 447
 		$this->setExperience($newExperience);
418 448
 		$this->decreaseHOF($experience,array('Experience','Total','Loss'), HOF_PUBLIC);
@@ -423,8 +453,9 @@  discard block
 block discarded – undo
423 453
 	}
424 454
 
425 455
 	public function setLandedOnPlanet($bool) {
426
-		if($this->landedOnPlanet == $bool)
427
-			return;
456
+		if($this->landedOnPlanet == $bool) {
457
+					return;
458
+		}
428 459
 		$this->landedOnPlanet=$bool;
429 460
 		$this->hasChanged=true;
430 461
 	}
@@ -438,7 +469,9 @@  discard block
 block discarded – undo
438 469
 		if ($this->level === null) {
439 470
 			$LEVELS_REQUIREMENTS = Globals::getLevelRequirements();
440 471
 			foreach ($LEVELS_REQUIREMENTS as $level_id => $require) {
441
-				if ($this->getExperience() >= $require['Requirement']) continue;
472
+				if ($this->getExperience() >= $require['Requirement']) {
473
+					continue;
474
+				}
442 475
 				$this->level = $level_id - 1;
443 476
 				return $this->level;
444 477
 			}
@@ -516,8 +549,9 @@  discard block
 block discarded – undo
516 549
 	}
517 550
 
518 551
 	public function setRaceID($raceID) {
519
-		if($this->raceID == $raceID)
520
-			return;
552
+		if($this->raceID == $raceID) {
553
+					return;
554
+		}
521 555
 		$this->raceID=$raceID;
522 556
 		$this->hasChanged=true;
523 557
 	}
@@ -539,8 +573,9 @@  discard block
 block discarded – undo
539 573
 	}
540 574
 
541 575
 	public function setAllianceID($ID) {
542
-		if($this->allianceID == $ID)
543
-			return;
576
+		if($this->allianceID == $ID) {
577
+					return;
578
+		}
544 579
 		$this->allianceID=$ID;
545 580
 		if ($this->allianceID != 0) {
546 581
 			$status = $this->hasNewbieStatus() ? 'NEWBIE' : 'VETERAN';
@@ -557,8 +592,7 @@  discard block
 block discarded – undo
557 592
 	public function getAllianceName($linked=false, $includeAllianceID=false) {
558 593
 		if($this->hasAlliance()) {
559 594
 			return $this->getAlliance()->getAllianceName($linked, $includeAllianceID);
560
-		}
561
-		else {
595
+		} else {
562 596
 			return 'No Alliance';
563 597
 		}
564 598
 	}
@@ -586,8 +620,9 @@  discard block
 block discarded – undo
586 620
 	}
587 621
 
588 622
 	public function setCombatDronesKamikazeOnMines($bool) {
589
-		if($this->combatDronesKamikazeOnMines == $bool)
590
-			return;
623
+		if($this->combatDronesKamikazeOnMines == $bool) {
624
+					return;
625
+		}
591 626
 		$this->combatDronesKamikazeOnMines = $bool;
592 627
 		$this->hasChanged=true;
593 628
 	}
@@ -604,15 +639,17 @@  discard block
 block discarded – undo
604 639
 			$gadgetID = $GADGETS[$gadgetID]['ID'];
605 640
 		}
606 641
 		$gadgets = $this->getGadgets();
607
-		if(isset($gadgets[$gadgetID]))
608
-			return $gadgets[$gadgetID];
642
+		if(isset($gadgets[$gadgetID])) {
643
+					return $gadgets[$gadgetID];
644
+		}
609 645
 		return false;
610 646
 	}
611 647
 
612 648
 	public function isGadgetEquipped($gadgetID) {
613 649
 		$gadget = $this->getGadget($gadgetID);
614
-		if($gadget===false)
615
-			return false;
650
+		if($gadget===false) {
651
+					return false;
652
+		}
616 653
 		return $gadget['Equipped'] > 0 && $gadget['Equipped'] < TIME && ($gadget['Expires'] == 0 || $gadget['Expires'] > TIME) && $gadget['Cooldown'] <= TIME;
617 654
 	}
618 655
 
@@ -684,21 +721,24 @@  discard block
 block discarded – undo
684 721
 	}
685 722
 
686 723
 	public function setMilitaryPayment($amount) {
687
-		if($this->militaryPayment == $amount)
688
-			return;
724
+		if($this->militaryPayment == $amount) {
725
+					return;
726
+		}
689 727
 		$this->militaryPayment = $amount;
690 728
 		$this->hasChanged=true;
691 729
 	}
692 730
 
693 731
 	public function increaseMilitaryPayment($amount) {
694
-		if($amount < 0)
695
-			throw new Exception('Trying to increase negative military payment.');
732
+		if($amount < 0) {
733
+					throw new Exception('Trying to increase negative military payment.');
734
+		}
696 735
 		$this->setMilitaryPayment($this->getMilitaryPayment()+$amount);
697 736
 	}
698 737
 
699 738
 	public function decreaseMilitaryPayment($amount) {
700
-		if($amount < 0)
701
-			throw new Exception('Trying to decrease negative military payment.');
739
+		if($amount < 0) {
740
+					throw new Exception('Trying to decrease negative military payment.');
741
+		}
702 742
 		$this->setMilitaryPayment($this->getMilitaryPayment()-$amount);
703 743
 	}
704 744
 
@@ -740,10 +780,11 @@  discard block
 block discarded – undo
740 780
 
741 781
 	public function getNextBountyID() {
742 782
 		$keys = array_keys($this->getBounties());
743
-		if(count($keys)>0)
744
-			return max($keys)+1;
745
-		else
746
-			return 0;
783
+		if(count($keys)>0) {
784
+					return max($keys)+1;
785
+		} else {
786
+					return 0;
787
+		}
747 788
 	}
748 789
 
749 790
 	public function setBounty(array $bounty) {
@@ -758,22 +799,25 @@  discard block
 block discarded – undo
758 799
 	}
759 800
 
760 801
 	public function increaseBountyAmount($bountyID,$amount) {
761
-		if($amount < 0)
762
-			throw new Exception('Trying to increase negative bounty.');
802
+		if($amount < 0) {
803
+					throw new Exception('Trying to increase negative bounty.');
804
+		}
763 805
 		$this->setBountyAmount($this->getBountyAmount($bountyID)+$amount);
764 806
 	}
765 807
 
766 808
 	public function decreaseBountyAmount($bountyID,$amount) {
767
-		if($amount < 0)
768
-			throw new Exception('Trying to decrease negative bounty.');
809
+		if($amount < 0) {
810
+					throw new Exception('Trying to decrease negative bounty.');
811
+		}
769 812
 		$this->setBountyAmount($this->getBountyAmount($bountyID)+$amount);
770 813
 	}
771 814
 
772 815
 	public function getCurrentBounty($type) {
773 816
 		$bounties = $this->getBounties();
774 817
 		foreach($bounties as $bounty) {
775
-			if($bounty['Claimer'] == 0 && $bounty['Type']==$type)
776
-				return $bounty;
818
+			if($bounty['Claimer'] == 0 && $bounty['Type']==$type) {
819
+							return $bounty;
820
+			}
777 821
 		}
778 822
 		return $this->createBounty($type);
779 823
 	}
@@ -781,8 +825,9 @@  discard block
 block discarded – undo
781 825
 	public function hasCurrentBounty($type) {
782 826
 		$bounties = $this->getBounties();
783 827
 		foreach($bounties as $bounty) {
784
-			if($bounty['Claimer'] == 0 && $bounty['Type']==$type)
785
-				return true;
828
+			if($bounty['Claimer'] == 0 && $bounty['Type']==$type) {
829
+							return true;
830
+			}
786 831
 		}
787 832
 		return false;
788 833
 	}
@@ -794,21 +839,24 @@  discard block
 block discarded – undo
794 839
 
795 840
 	public function setCurrentBountyAmount($type, $amount) {
796 841
 		$bounty = $this->getCurrentBounty($type);
797
-		if($bounty['Amount'] == $amount)
798
-			return;
842
+		if($bounty['Amount'] == $amount) {
843
+					return;
844
+		}
799 845
 		$bounty['Amount'] = $amount;
800 846
 		$this->setBounty($bounty);
801 847
 	}
802 848
 
803 849
 	public function increaseCurrentBountyAmount($type,$amount) {
804
-		if($amount < 0)
805
-			throw new Exception('Trying to increase negative current bounty.');
850
+		if($amount < 0) {
851
+					throw new Exception('Trying to increase negative current bounty.');
852
+		}
806 853
 		$this->setCurrentBountyAmount($type,$this->getCurrentBountyAmount($type)+$amount);
807 854
 	}
808 855
 
809 856
 	public function decreaseCurrentBountyAmount($type,$amount) {
810
-		if($amount < 0)
811
-			throw new Exception('Trying to decrease negative current bounty.');
857
+		if($amount < 0) {
858
+					throw new Exception('Trying to decrease negative current bounty.');
859
+		}
812 860
 		$this->setCurrentBountyAmount($type,$this->getCurrentBountyAmount($type)-$amount);
813 861
 	}
814 862
 
@@ -819,21 +867,24 @@  discard block
 block discarded – undo
819 867
 
820 868
 	public function setCurrentBountySmrCredits($type, $credits) {
821 869
 		$bounty = $this->getCurrentBounty($type);
822
-		if($bounty['SmrCredits'] == $credits)
823
-			return;
870
+		if($bounty['SmrCredits'] == $credits) {
871
+					return;
872
+		}
824 873
 		$bounty['SmrCredits'] = $credits;
825 874
 		$this->setBounty($bounty);
826 875
 	}
827 876
 
828 877
 	public function increaseCurrentBountySmrCredits($type,$credits) {
829
-		if($credits<0)
830
-			throw new Exception('Trying to increase negative current bounty.');
878
+		if($credits<0) {
879
+					throw new Exception('Trying to increase negative current bounty.');
880
+		}
831 881
 		$this->setCurrentBountySmrCredits($type,$this->getCurrentBountySmrCredits($type)+$credits);
832 882
 	}
833 883
 
834 884
 	public function decreaseCurrentBountySmrCredits($type,$credits) {
835
-		if($credits<0)
836
-			throw new Exception('Trying to decrease negative current bounty.');
885
+		if($credits<0) {
886
+					throw new Exception('Trying to decrease negative current bounty.');
887
+		}
837 888
 		$this->setCurrentBountySmrCredits($type,$this->getCurrentBountySmrCredits($type)-$credits);
838 889
 	}
839 890
 
@@ -854,51 +905,59 @@  discard block
 block discarded – undo
854 905
 
855 906
 	public function getHOF(array $typeList = null) {
856 907
 		$this->getHOFData();
857
-		if($typeList==null)
858
-			return $this->HOF;
908
+		if($typeList==null) {
909
+					return $this->HOF;
910
+		}
859 911
 		$hof=$this->HOF;
860 912
 		foreach($typeList as $type) {
861
-			if(!isset($hof[$type]))
862
-				return 0;
913
+			if(!isset($hof[$type])) {
914
+							return 0;
915
+			}
863 916
 			$hof = $hof[$type];
864 917
 		}
865 918
 		return $hof;
866 919
 	}
867 920
 
868 921
 	public function increaseHOF($amount,array $typeList, $visibility) {
869
-		if($amount < 0)
870
-			throw new Exception('Trying to increase negative HOF: '.implode(':',$typeList));
871
-		if($amount == 0)
872
-			return;
922
+		if($amount < 0) {
923
+					throw new Exception('Trying to increase negative HOF: '.implode(':',$typeList));
924
+		}
925
+		if($amount == 0) {
926
+					return;
927
+		}
873 928
 		$this->setHOF($this->getHOF($typeList)+$amount,$typeList, $visibility);
874 929
 	}
875 930
 
876 931
 	public function decreaseHOF($amount,array $typeList, $visibility) {
877
-		if($amount < 0)
878
-			throw new Exception('Trying to decrease negative HOF: '.implode(':',$typeList));
879
-		if($amount == 0)
880
-			return;
932
+		if($amount < 0) {
933
+					throw new Exception('Trying to decrease negative HOF: '.implode(':',$typeList));
934
+		}
935
+		if($amount == 0) {
936
+					return;
937
+		}
881 938
 		$this->setHOF($this->getHOF($typeList)-$amount,$typeList, $visibility);
882 939
 	}
883 940
 
884 941
 	public function setHOF($amount,array $typeList, $visibility) {
885
-		if(is_array($this->getHOF($typeList)))
886
-			throw new Exception('Trying to overwrite a HOF type: '.implode(':',$typeList));
942
+		if(is_array($this->getHOF($typeList))) {
943
+					throw new Exception('Trying to overwrite a HOF type: '.implode(':',$typeList));
944
+		}
887 945
 		if($this->isNPC()) {
888 946
 			// Don't store HOF for NPCs.
889 947
 			return;
890 948
 		}
891
-		if($this->getHOF($typeList)==$amount)
892
-			return;
893
-		if($amount < 0)
894
-			$amount=0;
949
+		if($this->getHOF($typeList)==$amount) {
950
+					return;
951
+		}
952
+		if($amount < 0) {
953
+					$amount=0;
954
+		}
895 955
 		$this->getHOF();
896 956
 
897 957
 		$hofType = implode(':',$typeList);
898 958
 		if(!isset(self::$HOFVis[$hofType])) {
899 959
 			self::$hasHOFVisChanged[$hofType] = self::HOF_NEW;
900
-		}
901
-		else if(self::$HOFVis[$hofType] != $visibility) {
960
+		} else if(self::$HOFVis[$hofType] != $visibility) {
902 961
 			self::$hasHOFVisChanged[$hofType] = self::HOF_CHANGED;
903 962
 		}
904 963
 		self::$HOFVis[$hofType] = $visibility;
@@ -907,8 +966,9 @@  discard block
 block discarded – undo
907 966
 		$hofChanged =& $this->hasHOFChanged;
908 967
 		$new = false;
909 968
 		foreach($typeList as $type) {
910
-			if(!isset($hofChanged[$type]))
911
-				$hofChanged[$type] = array();
969
+			if(!isset($hofChanged[$type])) {
970
+							$hofChanged[$type] = array();
971
+			}
912 972
 			if(!isset($hof[$type])) {
913 973
 				$hof[$type] = array();
914 974
 				$new = true;
@@ -918,8 +978,9 @@  discard block
 block discarded – undo
918 978
 		}
919 979
 		if($hofChanged==null) {
920 980
 			$hofChanged = self::HOF_CHANGED;
921
-			if($new)
922
-				$hofChanged = self::HOF_NEW;
981
+			if($new) {
982
+							$hofChanged = self::HOF_NEW;
983
+			}
923 984
 		}
924 985
 		$hof = $amount;
925 986
 	}
@@ -945,16 +1006,19 @@  discard block
 block discarded – undo
945 1006
 	}
946 1007
 
947 1008
 	public function setTurns($turns,$newNoob = false,$updateLastActive = false) {
948
-		if($this->turns == $turns && ($this->newbieTurns == $newNoob || $newNoob==false) && !$updateLastActive)
949
-			return;
1009
+		if($this->turns == $turns && ($this->newbieTurns == $newNoob || $newNoob==false) && !$updateLastActive) {
1010
+					return;
1011
+		}
950 1012
 
951 1013
 		// Make sure turns are in range [0, MaxTurns]
952 1014
 		$this->turns = max(0, min($turns, $this->getMaxTurns()));
953 1015
 
954
-		if($newNoob !== false)
955
-			$this->newbieTurns = $newNoob;
956
-		if ($this->newbieTurns < 0)
957
-			$this->newbieTurns = 0;
1016
+		if($newNoob !== false) {
1017
+					$this->newbieTurns = $newNoob;
1018
+		}
1019
+		if ($this->newbieTurns < 0) {
1020
+					$this->newbieTurns = 0;
1021
+		}
958 1022
 
959 1023
 		$this->hasChanged=true;
960 1024
 		if($updateLastActive === true) {
@@ -964,8 +1028,9 @@  discard block
 block discarded – undo
964 1028
 	}
965 1029
 
966 1030
 	public function takeTurns($take, $noob = 0, $updateLastActive = true) {
967
-		if($take < 0 || $noob < 0)
968
-			throw new Exception('Trying to take negative turns.');
1031
+		if($take < 0 || $noob < 0) {
1032
+					throw new Exception('Trying to take negative turns.');
1033
+		}
969 1034
 		$take = ceil($take);
970 1035
 		$new_turns = $this->getTurns() - $take;
971 1036
 		$newbiesTaken = min($this->getNewbieTurns(),$noob);
@@ -978,8 +1043,9 @@  discard block
 block discarded – undo
978 1043
 	}
979 1044
 
980 1045
 	public function giveTurns($give, $noob = 0,$updateLastActive = false) {
981
-		if($give < 0 || $noob < 0)
982
-			throw new Exception('Trying to give negative turns.');
1046
+		if($give < 0 || $noob < 0) {
1047
+					throw new Exception('Trying to give negative turns.');
1048
+		}
983 1049
 		$give = floor($give);
984 1050
 
985 1051
 		$this->setTurns($this->getTurns() + $give, $this->getNewbieTurns() + $noob, $updateLastActive);
@@ -990,8 +1056,9 @@  discard block
 block discarded – undo
990 1056
 	}
991 1057
 
992 1058
 	public function setLastActive($lastActive) {
993
-		if($this->lastActive == $lastActive)
994
-			return;
1059
+		if($this->lastActive == $lastActive) {
1060
+					return;
1061
+		}
995 1062
 		$this->lastActive=$lastActive;
996 1063
 		$this->hasChanged=true;
997 1064
 	}
@@ -1001,8 +1068,9 @@  discard block
 block discarded – undo
1001 1068
 	}
1002 1069
 
1003 1070
 	public function setLastCPLAction($time) {
1004
-		if($this->lastCPLAction == $time)
1005
-			return;
1071
+		if($this->lastCPLAction == $time) {
1072
+					return;
1073
+		}
1006 1074
 		$this->lastCPLAction=$time;
1007 1075
 		$this->hasChanged=true;
1008 1076
 	}
@@ -1017,8 +1085,9 @@  discard block
 block discarded – undo
1017 1085
 			//Get Player missions
1018 1086
 			$this->db->query('SELECT mission_id FROM player_completed_mission WHERE ' . $this->SQL);
1019 1087
 			$this->completedMissions = array();
1020
-			while ($this->db->nextRecord())
1021
-				$this->completedMissions[$this->db->getField('mission_id')] = $this->db->getField('mission_id');
1088
+			while ($this->db->nextRecord()) {
1089
+							$this->completedMissions[$this->db->getField('mission_id')] = $this->db->getField('mission_id');
1090
+			}
1022 1091
 		}
1023 1092
 		return $this->completedMissions;
1024 1093
 	}
@@ -1055,8 +1124,9 @@  discard block
 block discarded – undo
1055 1124
 
1056 1125
 	function getMission($missionID) {
1057 1126
 		$missions = $this->getMissions();
1058
-		if(isset($missions[$missionID]))
1059
-			return $missions[$missionID];
1127
+		if(isset($missions[$missionID])) {
1128
+					return $missions[$missionID];
1129
+		}
1060 1130
 		return false;
1061 1131
 	}
1062 1132
 
@@ -1102,8 +1172,9 @@  discard block
 block discarded – undo
1102 1172
 	function addMission($missionID) {
1103 1173
 		$this->getMissions();
1104 1174
 
1105
-		if(isset($this->missions[$missionID]))
1106
-			return;
1175
+		if(isset($this->missions[$missionID])) {
1176
+					return;
1177
+		}
1107 1178
 		$sector = 0;
1108 1179
 
1109 1180
 		$mission = array(
@@ -1132,8 +1203,7 @@  discard block
 block discarded – undo
1132 1203
 		if ($mission['On Step'] >= count(MISSIONS[$missionID]['Steps'])) {
1133 1204
 			// If we have completed this mission just use false to indicate no current task.
1134 1205
 			$currentStep = false;
1135
-		}
1136
-		else {
1206
+		} else {
1137 1207
 			$currentStep = MISSIONS[$missionID]['Steps'][$mission['On Step']];
1138 1208
 			$currentStep['Text'] = str_replace(array('<Race>','<Sector>','<Starting Sector>','<trader>'),array($this->getRaceID(),$mission['Sector'],$mission['Starting Sector'],$this->playerName),$currentStep['Text']);
1139 1209
 			if (isset($currentStep['Task'])) {
@@ -1141,8 +1211,7 @@  discard block
 block discarded – undo
1141 1211
 			}
1142 1212
 			if (isset($currentStep['Level'])) {
1143 1213
 				$currentStep['Level'] = str_replace('<Player Level>', $this->getLevelID(), $currentStep['Level']);
1144
-			}
1145
-			else {
1214
+			} else {
1146 1215
 				$currentStep['Level'] = 0;
1147 1216
 			}
1148 1217
 		}
@@ -1270,12 +1339,15 @@  discard block
 block discarded – undo
1270 1339
 	}
1271 1340
 
1272 1341
 	public function canSee(AbstractSmrPlayer $otherPlayer) {
1273
-		if(!$otherPlayer->getShip()->isCloaked())
1274
-			return true;
1275
-		if($this->sameAlliance($otherPlayer))
1276
-			return true;
1277
-		if($this->getExperience()>=$otherPlayer->getExperience())
1278
-			return true;
1342
+		if(!$otherPlayer->getShip()->isCloaked()) {
1343
+					return true;
1344
+		}
1345
+		if($this->sameAlliance($otherPlayer)) {
1346
+					return true;
1347
+		}
1348
+		if($this->getExperience()>=$otherPlayer->getExperience()) {
1349
+					return true;
1350
+		}
1279 1351
 		return false;
1280 1352
 	}
1281 1353
 
@@ -1328,10 +1400,12 @@  discard block
 block discarded – undo
1328 1400
 	}
1329 1401
 
1330 1402
 	public function meetsAlignmentRestriction($restriction) {
1331
-		if($restriction<0)
1332
-			return $this->getAlignment()<=$restriction;
1333
-		if($restriction>0)
1334
-			return $this->getAlignment()>=$restriction;
1403
+		if($restriction<0) {
1404
+					return $this->getAlignment()<=$restriction;
1405
+		}
1406
+		if($restriction>0) {
1407
+					return $this->getAlignment()>=$restriction;
1408
+		}
1335 1409
 		return true;
1336 1410
 	}
1337 1411
 
@@ -1354,8 +1428,9 @@  discard block
 block discarded – undo
1354 1428
 		if(!isset($this->visitedSectors)) {
1355 1429
 			$this->visitedSectors = array();
1356 1430
 			$this->db->query('SELECT sector_id FROM player_visited_sector WHERE ' . $this->SQL);
1357
-			while($this->db->nextRecord())
1358
-				$this->visitedSectors[$this->db->getField('sector_id')] = false;
1431
+			while($this->db->nextRecord()) {
1432
+							$this->visitedSectors[$this->db->getField('sector_id')] = false;
1433
+			}
1359 1434
 		}
1360 1435
 		return !isset($this->visitedSectors[$sectorID]);
1361 1436
 	}
Please login to merge, or discard this patch.