Completed
Push — master ( 5f69d8...11966f )
by Jakub
07:32
created
src/SkillSpecial.php 1 patch
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -74,7 +74,7 @@
 block discarded – undo
74 74
     });
75 75
     $resolver->setAllowedTypes("stat", ["string", "null"]);
76 76
     $resolver->setAllowedValues("stat", function(?string $value) {
77
-      return is_null($value) OR in_array($value, $this->getAllowedStats(), true);
77
+      return is_null($value) or in_array($value, $this->getAllowedStats(), true);
78 78
     });
79 79
     $resolver->setAllowedTypes("value", "integer");
80 80
     $resolver->setAllowedValues("value", function(int $value) {
Please login to merge, or discard this patch.
src/CharacterEffect.php 1 patch
Upper-Lower-Casing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
     $resolver->setAllowedTypes("stat", "string");
53 53
     $resolver->setDefault("stat", "");
54 54
     $resolver->setAllowedValues("stat", function(string $value) {
55
-      return $value === "" OR in_array($value, $this->getAllowedStats(), true);
55
+      return $value === "" or in_array($value, $this->getAllowedStats(), true);
56 56
     });
57 57
     $resolver->setAllowedTypes("source", "string");
58 58
     $resolver->setAllowedValues("source", function(string $value) {
@@ -62,10 +62,10 @@  discard block
 block discarded – undo
62 62
     $resolver->setDefault("value", 0);
63 63
     $resolver->setAllowedTypes("duration", ["string", "integer"]);
64 64
     $resolver->setAllowedValues("duration", function($value) {
65
-      return (in_array($value, $this->getDurations(), true)) OR ($value > 0);
65
+      return (in_array($value, $this->getDurations(), true)) or ($value > 0);
66 66
     });
67 67
     $effect = $resolver->resolve($effect);
68
-    if(!in_array($effect["type"], SkillSpecial::NO_STAT_TYPES, true) AND $effect["stat"] === "") {
68
+    if(!in_array($effect["type"], SkillSpecial::NO_STAT_TYPES, true) and $effect["stat"] === "") {
69 69
       throw new \InvalidArgumentException("The option stat with value '' is invalid.");
70 70
     }
71 71
     $this->id = $effect["id"];
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
    * @throws \InvalidArgumentException
136 136
    */
137 137
   public function setDuration($value) {
138
-    if(!is_int($value) AND !in_array($value, $this->getDurations(), true)) {
138
+    if(!is_int($value) and !in_array($value, $this->getDurations(), true)) {
139 139
       throw new \InvalidArgumentException("Invalid value set to CharacterEffect::\$duration. Expected string or integer.");
140 140
     }
141 141
     $this->duration = $value;
Please login to merge, or discard this patch.
src/CharacterAttackSkill.php 1 patch
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@
 block discarded – undo
38 38
   }
39 39
   
40 40
   public function getHitRate(): int {
41
-    if(is_string($this->skill->hitRate) AND substr($this->skill->hitRate, -1) === "%") {
41
+    if(is_string($this->skill->hitRate) and substr($this->skill->hitRate, -1) === "%") {
42 42
       return (int) $this->skill->hitRate;
43 43
     }
44 44
     return 100;
Please login to merge, or discard this patch.
src/CombatLogger.php 1 patch
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -75,7 +75,7 @@
 block discarded – undo
75 75
    */
76 76
   public function setTemplate(string $template): void {
77 77
     if(!is_file($template)) {
78
-      throw new \RuntimeException("File $template does not exist.");
78
+      throw new \RuntimeException("file $template does not exist.");
79 79
     }
80 80
     $this->template = $template;
81 81
   }
Please login to merge, or discard this patch.
src/Character.php 1 patch
Upper-Lower-Casing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -520,7 +520,7 @@  discard block
 block discarded – undo
520 520
   public function damageStat(): string {
521 521
     $stat = static::STAT_STRENGTH;
522 522
     foreach($this->equipment as $item) {
523
-      if(!$item->worn OR $item->slot != Equipment::SLOT_WEAPON) {
523
+      if(!$item->worn or $item->slot != Equipment::SLOT_WEAPON) {
524 524
         continue;
525 525
       }
526 526
       switch($item->type) {
@@ -579,7 +579,7 @@  discard block
 block discarded – undo
579 579
       $stat = $effect->stat;
580 580
       $type = $effect->type;
581 581
       $duration = $effect->duration;
582
-      if(is_int($duration) AND $duration < 1) {
582
+      if(is_int($duration) and $duration < 1) {
583 583
         $this->removeEffect($effect->id);
584 584
         continue;
585 585
       }
Please login to merge, or discard this patch.
src/CombatActionSelector.php 1 patch
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@
 block discarded – undo
23 23
   public function chooseAction(CombatBase $combat, Character $character): ?string {
24 24
     if($character->hitpoints < 1) {
25 25
       return null;
26
-    } elseif(in_array($character, $combat->findHealers()->toArray(), true) AND !is_null($combat->selectHealingTarget($character))) {
26
+    } elseif(in_array($character, $combat->findHealers()->toArray(), true) and !is_null($combat->selectHealingTarget($character))) {
27 27
       return CombatAction::ACTION_HEALING;
28 28
     }
29 29
     $attackTarget = $combat->selectAttackTarget($character);
Please login to merge, or discard this patch.
src/Team.php 1 patch
Upper-Lower-Casing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -80,11 +80,11 @@  discard block
 block discarded – undo
80 80
    */
81 81
   public function setCharacterPosition($id, int $row, int $column): void {
82 82
     if(!$this->hasItems(["id" => $id])) {
83
-      throw new \OutOfBoundsException("Character $id is not in the team");
83
+      throw new \OutOfBoundsException("character $id is not in the team");
84 84
     } elseif(count($this->getItems(["positionRow" => $row])) >= $this->maxRowSize) {
85
-      throw new InvalidCharacterPositionException("Row $row is full.", InvalidCharacterPositionException::ROW_FULL);
85
+      throw new InvalidCharacterPositionException("row $row is full.", InvalidCharacterPositionException::ROW_FULL);
86 86
     } elseif($this->hasItems(["positionRow" => $row, "positionColumn" => $column])) {
87
-      throw new InvalidCharacterPositionException("Row $row column $column is occupied.", InvalidCharacterPositionException::POSITION_OCCUPIED);
87
+      throw new InvalidCharacterPositionException("row $row column $column is occupied.", InvalidCharacterPositionException::POSITION_OCCUPIED);
88 88
     }
89 89
     $character = $this->getItems(["id" => $id])[0];
90 90
     $character->positionRow = $row;
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
       return null;
113 113
     }
114 114
     foreach($this->aliveMembers as $index => $member) {
115
-      if($member->hitpoints <= $member->maxHitpoints * $threshold AND $member->hitpoints < $lowestHp) {
115
+      if($member->hitpoints <= $member->maxHitpoints * $threshold and $member->hitpoints < $lowestHp) {
116 116
         $lowestHp = $member->hitpoints;
117 117
         $lowestIndex = $index;
118 118
       }
Please login to merge, or discard this patch.
src/CombatBase.php 1 patch
Upper-Lower-Casing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
       foreach($team as $character) {
238 238
         try {
239 239
           $column++;
240
-          if($character->positionRow > 0 AND $character->positionColumn > 0) {
240
+          if($character->positionRow > 0 and $character->positionColumn > 0) {
241 241
             continue;
242 242
           }
243 243
           setPosition:
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
     $characters = array_merge($combat->team1->toArray(), $combat->team2->toArray());
291 291
     foreach($characters as $character) {
292 292
       foreach($character->effects as $effect) {
293
-        if($effect->duration === CharacterEffect::DURATION_COMBAT OR is_int($effect->duration)) {
293
+        if($effect->duration === CharacterEffect::DURATION_COMBAT or is_int($effect->duration)) {
294 294
           $character->removeEffect($effect->id);
295 295
         }
296 296
       }
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
     $enemyTeam = $this->getEnemyTeam($attacker);
353 353
     $rangedWeapon = false;
354 354
     foreach($attacker->equipment as $equipment) {
355
-      if($equipment instanceof Weapon AND $equipment->isWorn() AND $equipment->ranged) {
355
+      if($equipment instanceof Weapon and $equipment->isWorn() and $equipment->ranged) {
356 356
         $rangedWeapon = true;
357 357
         break;
358 358
       }
@@ -412,7 +412,7 @@  discard block
 block discarded – undo
412 412
         $targets = $this->getTeam($primaryTarget)->getItems(["positionColumn" => $primaryTarget->positionColumn]);
413 413
         break;
414 414
       default:
415
-        throw new NotImplementedException("Target $skill->skill->target for attack skills is not implemented.");
415
+        throw new NotImplementedException("target $skill->skill->target for attack skills is not implemented.");
416 416
     }
417 417
     foreach($targets as $target) {
418 418
       for($i = 1; $i <= $skill->skill->strikes; $i++) {
@@ -440,7 +440,7 @@  discard block
 block discarded – undo
440 440
         $targets = $this->getEnemyTeam($character)->toArray();
441 441
         break;
442 442
       default:
443
-        throw new NotImplementedException("Target $skill->skill->target for special skills is not implemented.");
443
+        throw new NotImplementedException("target $skill->skill->target for special skills is not implemented.");
444 444
     }
445 445
     foreach($targets as $target) {
446 446
       $this->onSkillSpecial($character, $target, $skill);
@@ -478,7 +478,7 @@  discard block
 block discarded – undo
478 478
           $combat->onHeal($character, $combat->selectHealingTarget($character));
479 479
           break;
480 480
         default:
481
-          throw new NotImplementedException("Action $action is not implemented.");
481
+          throw new NotImplementedException("action $action is not implemented.");
482 482
       }
483 483
     }
484 484
   }
@@ -589,7 +589,7 @@  discard block
 block discarded – undo
589 589
       "character1" => $character1, "character2" => $target,
590 590
     ];
591 591
     $effect = new CharacterEffect([
592
-      "id" => "skill{$skill->skill->id}Effect",
592
+      "id" => "skill{$skill->skill->id}effect",
593 593
       "type" => $skill->skill->type,
594 594
       "stat" => ((in_array($skill->skill->type, SkillSpecial::NO_STAT_TYPES, true)) ? null : $skill->skill->stat),
595 595
       "value" => $skill->value,
Please login to merge, or discard this patch.