Passed
Branch master (f29677)
by Jakub
04:40
created
src/Equipment.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-declare(strict_types=1);
2
+declare(strict_types = 1);
3 3
 
4 4
 namespace HeroesofAbenez\Combat;
5 5
 
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
   protected $worn;
50 50
   
51 51
   public function __construct(array $data) {
52
-    $allStats = ["id", "name", "slot", "type", "strength", "worn",];
52
+    $allStats = ["id", "name", "slot", "type", "strength", "worn", ];
53 53
     $resolver = new OptionsResolver();
54 54
     $resolver->setDefined($allStats);
55 55
     $resolver->setRequired($allStats);
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@
 block discarded – undo
61 61
     });
62 62
     $resolver->setAllowedTypes("type", ["string", "null"]);
63 63
     $resolver->setAllowedValues("type", function(?string $value) {
64
-      return is_null($value) OR in_array($value, $this->getAllowedTypes(), true);
64
+      return is_null($value) or in_array($value, $this->getAllowedTypes(), true);
65 65
     });
66 66
     $resolver->setAllowedTypes("strength", "integer");
67 67
     $resolver->setAllowedValues("strength", function(int $value) {
Please login to merge, or discard this patch.
src/Team.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 block discarded – undo
1 1
 <?php
2
-declare(strict_types=1);
2
+declare(strict_types = 1);
3 3
 
4 4
 namespace HeroesofAbenez\Combat;
5 5
 
Please login to merge, or discard this patch.
Upper-Lower-Casing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
    */
71 71
   public function getActiveMembers(): array {
72 72
     return array_values(array_filter($this->items, function(Character $value) {
73
-      return (!$value->stunned AND $value->hitpoints > 0);
73
+      return (!$value->stunned and $value->hitpoints > 0);
74 74
     }));
75 75
   }
76 76
   
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
    */
93 93
   public function getUsableMembers(): array {
94 94
     return array_values(array_filter($this->items, function(Character $value) {
95
-      return (!$value->stunned AND $value->hitpoints > 0);
95
+      return (!$value->stunned and $value->hitpoints > 0);
96 96
     }));
97 97
   }
98 98
   
Please login to merge, or discard this patch.
src/CharacterAttackSkill.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 block discarded – undo
1 1
 <?php
2
-declare(strict_types=1);
2
+declare(strict_types = 1);
3 3
 
4 4
 namespace HeroesofAbenez\Combat;
5 5
 
Please login to merge, or discard this patch.
src/ImmutableException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 block discarded – undo
1 1
 <?php
2
-declare(strict_types=1);
2
+declare(strict_types = 1);
3 3
 
4 4
 namespace HeroesofAbenez\Combat;
5 5
 
Please login to merge, or discard this patch.
src/CombatBase.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-declare(strict_types=1);
2
+declare(strict_types = 1);
3 3
 
4 4
 namespace HeroesofAbenez\Combat;
5 5
 
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
     $this->onCombatEnd[] = [$this, "removeCombatEffects"];
79 79
     $this->onCombatEnd[] = [$this, "logCombatResult"];
80 80
     $this->onCombatEnd[] = [$this, "resetInitiative"];
81
-    $this->onRoundStart[] = [$this ,"recalculateStats"];
81
+    $this->onRoundStart[] = [$this, "recalculateStats"];
82 82
     $this->onRoundStart[] = [$this, "logRoundNumber"];
83 83
     $this->onRoundStart[] = [$this, "applyPoison"];
84 84
     $this->onRound[] = [$this, "mainStage"];
Please login to merge, or discard this patch.
Upper-Lower-Casing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
     $characters = array_merge($combat->team1->items, $combat->team2->items);
298 298
     foreach($characters as $character) {
299 299
       foreach($character->effects as $effect) {
300
-        if($effect->duration === CharacterEffect::DURATION_COMBAT OR is_int($effect->duration)) {
300
+        if($effect->duration === CharacterEffect::DURATION_COMBAT or is_int($effect->duration)) {
301 301
           $character->removeEffect($effect->id);
302 302
         }
303 303
       }
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
       $threshold = static::LOWEST_HP_THRESHOLD;
389 389
     }
390 390
     foreach($team->aliveMembers as $index => $member) {
391
-      if($member->hitpoints <= $member->maxHitpoints * $threshold AND $member->hitpoints < $lowestHp) {
391
+      if($member->hitpoints <= $member->maxHitpoints * $threshold and $member->hitpoints < $lowestHp) {
392 392
         $lowestHp = $member->hitpoints;
393 393
         $lowestIndex = $index;
394 394
       }
@@ -440,7 +440,7 @@  discard block
 block discarded – undo
440 440
   protected function chooseAction(CombatBase $combat, Character $character): ?string {
441 441
     if($character->hitpoints < 1) {
442 442
       return NULL;
443
-    } elseif(in_array($character, $combat->findHealers()->items, true) AND !is_null($combat->selectHealingTarget($character))) {
443
+    } elseif(in_array($character, $combat->findHealers()->items, true) and !is_null($combat->selectHealingTarget($character))) {
444 444
       return CombatAction::ACTION_HEALING;
445 445
     }
446 446
     $attackTarget = $combat->selectAttackTarget($character);
@@ -635,7 +635,7 @@  discard block
 block discarded – undo
635 635
     ];
636 636
     $this->results = $result;
637 637
     $effect = [
638
-      "id" => "skill{$skill->skill->id}Effect",
638
+      "id" => "skill{$skill->skill->id}effect",
639 639
       "type" => $skill->skill->type,
640 640
       "stat" => ((in_array($skill->skill->type, SkillSpecial::NO_STAT_TYPES, true)) ? NULL : $skill->skill->stat),
641 641
       "value" => $skill->value,
Please login to merge, or discard this patch.
src/Character.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-declare(strict_types=1);
2
+declare(strict_types = 1);
3 3
 
4 4
 namespace HeroesofAbenez\Combat;
5 5
 
@@ -156,10 +156,10 @@  discard block
 block discarded – undo
156 156
   }
157 157
   
158 158
   protected function setStats(array $stats): void {
159
-    $requiredStats = ["id", "name", "level", "strength", "dexterity", "constitution", "intelligence", "charisma", "initiativeFormula",];
160
-    $allStats = array_merge($requiredStats, ["occupation", "race", "specialization", "gender", "experience",]);
161
-    $numberStats = ["strength", "dexterity", "constitution", "intelligence", "charisma",];
162
-    $textStats = ["name", "race", "occupation", "initiativeFormula",];
159
+    $requiredStats = ["id", "name", "level", "strength", "dexterity", "constitution", "intelligence", "charisma", "initiativeFormula", ];
160
+    $allStats = array_merge($requiredStats, ["occupation", "race", "specialization", "gender", "experience", ]);
161
+    $numberStats = ["strength", "dexterity", "constitution", "intelligence", "charisma", ];
162
+    $textStats = ["name", "race", "occupation", "initiativeFormula", ];
163 163
     $resolver = new OptionsResolver();
164 164
     $resolver->setDefined($allStats);
165 165
     $resolver->setAllowedTypes("id", ["integer", "string"]);
@@ -401,7 +401,7 @@  discard block
 block discarded – undo
401 401
   public function equipItem(int $itemId): void {
402 402
     try {
403 403
       $item = $this->getItem($itemId);
404
-    } catch (\OutOfBoundsException $e) {
404
+    } catch(\OutOfBoundsException $e) {
405 405
       throw $e;
406 406
     }
407 407
     $itemBonus = new CharacterEffect($item->deployParams);
@@ -416,7 +416,7 @@  discard block
 block discarded – undo
416 416
   public function unequipItem(int $itemId): void {
417 417
     try {
418 418
       $item = $this->getItem($itemId);
419
-    } catch (\OutOfBoundsException $e) {
419
+    } catch(\OutOfBoundsException $e) {
420 420
       throw $e;
421 421
     }
422 422
     $itemBonus = $item->deployParams;
Please login to merge, or discard this patch.
Upper-Lower-Casing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -429,7 +429,7 @@  discard block
 block discarded – undo
429 429
    * @throws \OutOfBoundsException
430 430
    */
431 431
   public function getPet(int $petId): Pet {
432
-    if(isset($this->pets[$petId]) AND $this->pets[$petId] instanceof Pet) {
432
+    if(isset($this->pets[$petId]) and $this->pets[$petId] instanceof Pet) {
433 433
       return $this->pets[$petId];
434 434
     }
435 435
     throw new \OutOfBoundsException("Pet was not found.");
@@ -489,7 +489,7 @@  discard block
 block discarded – undo
489 489
   public function damageStat(): string {
490 490
     $stat = "strength";
491 491
     foreach($this->equipment as $item) {
492
-      if(!$item->worn OR $item->slot != Equipment::SLOT_WEAPON) {
492
+      if(!$item->worn or $item->slot != Equipment::SLOT_WEAPON) {
493 493
         continue;
494 494
       }
495 495
       switch($item->type) {
@@ -542,7 +542,7 @@  discard block
 block discarded – undo
542 542
       $stat = $effect->stat;
543 543
       $type = $effect->type;
544 544
       $duration = $effect->duration;
545
-      if(is_int($duration) AND $duration < 0) {
545
+      if(is_int($duration) and $duration < 0) {
546 546
         unset($this->effects[$i]);
547 547
         continue;
548 548
       }
Please login to merge, or discard this patch.
tests/bootstrap.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@
 block discarded – undo
1 1
 <?php
2
-declare(strict_types=1);
2
+declare(strict_types = 1);
3 3
 
4 4
 require __DIR__ . "/../vendor/autoload.php";
5
-Testbench\Bootstrap::setup(__DIR__ . '/_temp', function (\Nette\Configurator $configurator) {
6
-  $configurator->addParameters(["appDir" => __DIR__,]);
5
+Testbench\Bootstrap::setup(__DIR__ . '/_temp', function(\Nette\Configurator $configurator) {
6
+  $configurator->addParameters(["appDir" => __DIR__, ]);
7 7
   $configurator->addConfig(__DIR__ . "/tests.neon");
8 8
 });
9 9
 ?>
10 10
\ No newline at end of file
Please login to merge, or discard this patch.