Passed
Push — master ( 6656bb...f80d3f )
by Jakub
02:20
created
src/CombatActions/ICombatAction.php 1 patch
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -10,6 +10,8 @@
 block discarded – undo
10 10
   public function getName(): string;
11 11
   public function getPriority(): int;
12 12
   public function shouldUse(CombatBase $combat, Character $character): bool;
13
-  public function do(CombatBase $combat, Character $character): void;
14
-}
13
+  public function do {
14
+    (CombatBase $combat, Character $character): void;
15
+  }
16
+  }
15 17
 ?>
16 18
\ No newline at end of file
Please login to merge, or discard this patch.
src/CombatActions/Attack.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -26,8 +26,10 @@
 block discarded – undo
26 26
    * Hit chance = Attacker's hit - Defender's dodge, but at least 15%
27 27
    * Damage = Attacker's damage - defender's defense
28 28
    */
29
-  public function do(CombatBase $combat, Character $character): void {
29
+  public function do {
30
+    (CombatBase $combat, Character $character): void {
30 31
     $result = [];
32
+  }
31 33
     /** @var Character $defender */
32 34
     $defender = $combat->selectAttackTarget($character);
33 35
     $result["result"] = $combat->successCalculator->hasHit($character, $defender);
Please login to merge, or discard this patch.
src/CharacterEffect.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -70,7 +70,7 @@
 block discarded – undo
70 70
   }
71 71
 
72 72
   protected function configureOptions(OptionsResolver $resolver): void {
73
-    $allStats = ["id", "type", "value", "valueAbsolute", "duration", "stat",];
73
+    $allStats = ["id", "type", "value", "valueAbsolute", "duration", "stat", ];
74 74
     $resolver->setRequired($allStats);
75 75
     $resolver->setAllowedTypes("id", "string");
76 76
     $resolver->setAllowedTypes("type", "string");
Please login to merge, or discard this patch.
Upper-Lower-Casing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
     $resolver = new OptionsResolver();
47 47
     $this->configureOptions($resolver);
48 48
     $effect = $resolver->resolve($effect);
49
-    if(!in_array($effect["type"], SkillSpecial::NO_STAT_TYPES, true) AND $effect["stat"] === "") {
49
+    if(!in_array($effect["type"], SkillSpecial::NO_STAT_TYPES, true) and $effect["stat"] === "") {
50 50
       throw new \InvalidArgumentException("The option stat with value '' is invalid.");
51 51
     }
52 52
     $this->id = $effect["id"];
@@ -80,14 +80,14 @@  discard block
 block discarded – undo
80 80
     $resolver->setAllowedTypes("stat", "string");
81 81
     $resolver->setDefault("stat", "");
82 82
     $resolver->setAllowedValues("stat", function(string $value) {
83
-      return $value === "" OR in_array($value, $this->getAllowedStats(), true);
83
+      return $value === "" or in_array($value, $this->getAllowedStats(), true);
84 84
     });
85 85
     $resolver->setAllowedTypes("value", "integer");
86 86
     $resolver->setAllowedTypes("valueAbsolute", "bool");
87 87
     $resolver->setDefault("value", 0);
88 88
     $resolver->setAllowedTypes("duration", ["string", "integer"]);
89 89
     $resolver->setAllowedValues("duration", function($value) {
90
-      return (in_array($value, $this->getDurations(), true)) OR ($value > 0);
90
+      return (in_array($value, $this->getDurations(), true)) or ($value > 0);
91 91
     });
92 92
   }
93 93
   
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
    * @throws \InvalidArgumentException
149 149
    */
150 150
   public function setDuration($value): void {
151
-    if(!is_int($value) AND !in_array($value, $this->getDurations(), true)) {
151
+    if(!is_int($value) and !in_array($value, $this->getDurations(), true)) {
152 152
       throw new \InvalidArgumentException("Invalid value set to CharacterEffect::\$duration. Expected string or integer.");
153 153
     }
154 154
     $this->duration = $value;
Please login to merge, or discard this patch.
src/CombatLogEntry.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -51,8 +51,8 @@
 block discarded – undo
51 51
   }
52 52
 
53 53
   protected function configureOptions(OptionsResolver $resolver): void {
54
-    $requiredStats = ["action", "result", "character1", "character2",];
55
-    $resolver->setDefined(["amount", "name",]);
54
+    $requiredStats = ["action", "result", "character1", "character2", ];
55
+    $resolver->setDefined(["amount", "name", ]);
56 56
     $resolver->setRequired($requiredStats);
57 57
     $resolver->setAllowedTypes("action", "string");
58 58
     $resolver->setAllowedTypes("result", "bool");
Please login to merge, or discard this patch.
src/CombatBase.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
     $this->onCombatEnd[] = [$this, "resetInitiative"];
75 75
     $this->onRoundStart[] = [$this, "applyEffectProviders"];
76 76
     $this->onRoundStart[] = [$this, "decreaseEffectsDuration"];
77
-    $this->onRoundStart[] = [$this ,"recalculateStats"];
77
+    $this->onRoundStart[] = [$this, "recalculateStats"];
78 78
     $this->onRoundStart[] = [$this, "logRoundNumber"];
79 79
     $this->onRoundStart[] = [$this, "applyPoison"];
80 80
     $this->onRound[] = [$this, "mainStage"];
@@ -343,14 +343,14 @@  discard block
 block discarded – undo
343 343
    */
344 344
   public function selectAttackTarget(Character $attacker): ?Character {
345 345
     $enemyTeam = $this->getEnemyTeam($attacker);
346
-    $rangedWeapon = ($attacker->equipment->hasItems(["%class%" => Weapon::class, "worn" => true, "ranged" => true,]));
346
+    $rangedWeapon = ($attacker->equipment->hasItems(["%class%" => Weapon::class, "worn" => true, "ranged" => true, ]));
347 347
     if(!$rangedWeapon) {
348 348
       $rowToAttack = $enemyTeam->rowToAttack;
349 349
       if(is_null($rowToAttack)) {
350 350
         return null;
351 351
       }
352 352
       /** @var Team $enemies */
353
-      $enemies = Team::fromArray($enemyTeam->getItems(["positionRow" => $rowToAttack, "hitpoints>" => 0,]), $enemyTeam->name);
353
+      $enemies = Team::fromArray($enemyTeam->getItems(["positionRow" => $rowToAttack, "hitpoints>" => 0, ]), $enemyTeam->name);
354 354
     } else {
355 355
       $enemies = $enemyTeam;
356 356
     }
Please login to merge, or discard this patch.
Upper-Lower-Casing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
       foreach($team as $character) {
229 229
         try {
230 230
           $column++;
231
-          if($character->positionRow > 0 AND $character->positionColumn > 0) {
231
+          if($character->positionRow > 0 and $character->positionColumn > 0) {
232 232
             continue;
233 233
           }
234 234
           setPosition:
@@ -400,7 +400,7 @@  discard block
 block discarded – undo
400 400
           continue 2;
401 401
         }
402 402
       }
403
-      throw new NotImplementedException("Action $action is not implemented.");
403
+      throw new NotImplementedException("action $action is not implemented.");
404 404
     }
405 405
   }
406 406
   
Please login to merge, or discard this patch.
src/Character.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -201,10 +201,10 @@
 block discarded – undo
201 201
   }
202 202
   
203 203
   protected function setStats(array $stats): void {
204
-    $requiredStats = array_merge(["id", "name", "level", "initiativeFormula",], static::BASE_STATS);
205
-    $allStats = array_merge($requiredStats, ["occupation", "race", "specialization", "gender",]);
204
+    $requiredStats = array_merge(["id", "name", "level", "initiativeFormula", ], static::BASE_STATS);
205
+    $allStats = array_merge($requiredStats, ["occupation", "race", "specialization", "gender", ]);
206 206
     $numberStats = static::BASE_STATS;
207
-    $textStats = ["name", "race", "occupation", "specialization", "initiativeFormula",];
207
+    $textStats = ["name", "race", "occupation", "specialization", "initiativeFormula", ];
208 208
     $resolver = new OptionsResolver();
209 209
     $resolver->setDefined($allStats);
210 210
     $resolver->setAllowedTypes("id", ["integer", "string"]);
Please login to merge, or discard this patch.
src/TextCombatLogRender.php 1 patch
Upper-Lower-Casing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
    */
33 33
   public function setTemplate(string $template): void {
34 34
     if(!is_file($template)) {
35
-      throw new \RuntimeException("File $template does not exist.");
35
+      throw new \RuntimeException("file $template does not exist.");
36 36
     }
37 37
     $this->template = $template;
38 38
   }
@@ -55,14 +55,14 @@  discard block
 block discarded – undo
55 55
       case CombatActions\Attack::ACTION_NAME:
56 56
         $message = ($item->result) ? "combat.log.attackHits" : "combat.log.attackFails";
57 57
         $text = $this->translator->translate($message, $item->amount, ["character1" => $character1, "character2" => $character2]);
58
-        if($item->result AND $item->character2->hitpoints < 1) {
58
+        if($item->result and $item->character2->hitpoints < 1) {
59 59
           $text .= $this->translator->translate("combat.log.characterFalls");
60 60
         }
61 61
         return $text;
62 62
       case CombatActions\SkillAttack::ACTION_NAME:
63 63
         $message = ($item->result) ? "combat.log.specialAttackHits" : "combat.log.specialAttackFails";
64 64
         $text = $this->translator->translate($message, $item->amount, ["character1" => $character1, "character2" => $character2, "name" => $item->name]);
65
-        if($item->result AND $item->character2->hitpoints < 1) {
65
+        if($item->result and $item->character2->hitpoints < 1) {
66 66
           $text .= $this->translator->translate("combat.log.characterFalls");
67 67
         }
68 68
         return $text;
Please login to merge, or discard this patch.
src/CombatActions/Heal.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,8 +25,10 @@
 block discarded – undo
25 25
     return (in_array($character, $this->findHealers($combat)->toArray(), true) AND !is_null($this->selectHealingTarget($character, $combat)));
26 26
   }
27 27
 
28
-  public function do(CombatBase $combat, Character $character): void {
28
+  public function do {
29
+    (CombatBase $combat, Character $character): void {
29 30
     $result = [];
31
+  }
30 32
     /** @var Character $patient */
31 33
     $patient = $this->selectHealingTarget($character, $combat);
32 34
     $result["result"] = $combat->successCalculator->hasHealed($character);
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@
 block discarded – undo
22 22
   }
23 23
 
24 24
   public function shouldUse(CombatBase $combat, Character $character): bool {
25
-    return (in_array($character, $this->findHealers($combat)->toArray(), true) AND !is_null($this->selectHealingTarget($character, $combat)));
25
+    return (in_array($character, $this->findHealers($combat)->toArray(), true) and !is_null($this->selectHealingTarget($character, $combat)));
26 26
   }
27 27
 
28 28
   public function do(CombatBase $combat, Character $character): void {
Please login to merge, or discard this patch.