Completed
Push — master ( eb810e...271ec8 )
by Jérémy
08:37
created
src/Entities/Pokemon.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -70,11 +70,11 @@  discard block
 block discarded – undo
70 70
      * Return the minimum of perfection of a Pokemon
71 71
      * @return IvCombinaison|null
72 72
      */
73
-    public function getMinimumCombinaison(): ?IvCombinaison
73
+    public function getMinimumCombinaison(): ? IvCombinaison
74 74
     {
75 75
         return $this->getIvCombinaisons()
76 76
             ->sortBy(
77
-                function (IvCombinaison $combinaison) {
77
+                function(IvCombinaison $combinaison) {
78 78
                     return $combinaison->getPerfection();
79 79
                 })
80 80
             ->last();
@@ -84,11 +84,11 @@  discard block
 block discarded – undo
84 84
      * Return the maximum of perfection of a Pokemon
85 85
      * @return IvCombinaison|null
86 86
      */
87
-    public function getMaximumCombinaison(): ?IvCombinaison
87
+    public function getMaximumCombinaison(): ? IvCombinaison
88 88
     {
89 89
         return $this->getIvCombinaisons()
90 90
             ->sortBy(
91
-                function (IvCombinaison $combinaison) {
91
+                function(IvCombinaison $combinaison) {
92 92
                     return $combinaison->getPerfection();
93 93
                 })
94 94
             ->first();
@@ -98,10 +98,10 @@  discard block
 block discarded – undo
98 98
      * Return the average perfection of a Pokemon
99 99
      * @return float|null
100 100
      */
101
-    public function getAveragePerfection(): ?float
101
+    public function getAveragePerfection(): ? float
102 102
     {
103 103
         return $this->getIvCombinaisons()->average(
104
-            function (IvCombinaison $combinaison) {
104
+            function(IvCombinaison $combinaison) {
105 105
                 return $combinaison->getPerfection();
106 106
             });
107 107
     }
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
      *
146 146
      * @return int|null
147 147
      */
148
-    public function getCp(): ?int
148
+    public function getCp(): ? int
149 149
     {
150 150
         return $this->cp;
151 151
     }
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
      *
169 169
      * @return int|null
170 170
      */
171
-    public function getHp(): ?int
171
+    public function getHp(): ? int
172 172
     {
173 173
         return $this->hp;
174 174
     }
Please login to merge, or discard this patch.
src/Commands/CalculateCommand.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -84,7 +84,7 @@
 block discarded – undo
84 84
 
85 85
         (new Table($output))
86 86
             ->setHeaders(['Level', 'Attack IV', 'Defense IV', 'Stamina IV', 'Perfection'])
87
-            ->setRows($pokemon->getIvCombinaisons()->map(function (IvCombinaison $combinaison) {
87
+            ->setRows($pokemon->getIvCombinaisons()->map(function(IvCombinaison $combinaison) {
88 88
                 return [
89 89
                     $combinaison->getLevel()->getLevel(),
90 90
                     $combinaison->getAttack(),
Please login to merge, or discard this patch.
src/Calculator/Calculator.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -151,14 +151,14 @@
 block discarded – undo
151 151
     {
152 152
         $this->potentialCombinaisons = $this->potentialCombinaisons
153 153
             // Eliminate impossible combinaison for global combinaison
154
-            ->filter(function ($combinaison) use ($global) {
154
+            ->filter(function($combinaison) use ($global) {
155 155
                 if ($combinaison->getTotal() < $this->getMaxGlobalEvaluation($global)) {
156 156
                     return true;
157 157
                 }
158 158
                 return false;
159 159
             })
160 160
             // Eliminate impossible combinaisons with best stats
161
-            ->filter(function ($combinaison) use ($bestStats) {
161
+            ->filter(function($combinaison) use ($bestStats) {
162 162
                 $nonBestStats = array_diff(self::AVAILABLE_OPTIONS, $bestStats);
163 163
                 foreach ($nonBestStats as $nonBestStat) {
164 164
                     if ($combinaison->getAbbreviated($nonBestStat) < $combinaison->getMaximalIv()) {
Please login to merge, or discard this patch.
src/Extractors/Pokedex.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -24,13 +24,13 @@
 block discarded – undo
24 24
         $collection = $this->getGameMasterJsonCollection();
25 25
 
26 26
         $finded = $collection
27
-            ->filter(function ($line) {
27
+            ->filter(function($line) {
28 28
                 if (isset($line->pokemonSettings)) {
29 29
                     return true;
30 30
                 }
31 31
                 return false;
32 32
             })
33
-            ->filter(function ($line) use ($name) {
33
+            ->filter(function($line) use ($name) {
34 34
                 return $line->pokemonSettings->pokemonId === strtoupper($name);
35 35
             })
36 36
             ->first()
Please login to merge, or discard this patch.
tests/Extractors/Pokedex.spec.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -12,9 +12,9 @@  discard block
 block discarded – undo
12 12
 use Th3Mouk\PokemonGoIVCalculator\Exceptions\PokemonNotFound;
13 13
 use Th3Mouk\PokemonGoIVCalculator\Extractors\Pokedex;
14 14
 
15
-describe('Pokedex', function () {
16
-    describe('get(pikachu)', function () {
17
-        it("Should return a pokemon object of Pikachu", function () {
15
+describe('Pokedex', function() {
16
+    describe('get(pikachu)', function() {
17
+        it("Should return a pokemon object of Pikachu", function() {
18 18
             $pokemon = (new Pokedex())->get('pikachu');
19 19
 
20 20
             $assert = new Assert();
@@ -26,11 +26,11 @@  discard block
 block discarded – undo
26 26
         });
27 27
     });
28 28
 
29
-    describe('get(unknowedPkm)', function () {
30
-        it("Should throws a PokemonNotFound exception", function () {
29
+    describe('get(unknowedPkm)', function() {
30
+        it("Should throws a PokemonNotFound exception", function() {
31 31
             $assert = new Assert();
32 32
 
33
-            $assert->throws(function () {
33
+            $assert->throws(function() {
34 34
                 (new Pokedex())->get('unknowedPkm');
35 35
             }, PokemonNotFound::class);
36 36
         });
Please login to merge, or discard this patch.
tests/Extractors/LevelExtractor.spec.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -12,9 +12,9 @@  discard block
 block discarded – undo
12 12
 use Peridot\Leo\Interfaces\Assert;
13 13
 use Th3Mouk\PokemonGoIVCalculator\Extractors\LevelExtractor;
14 14
 
15
-describe('LevelExtractor', function () {
16
-    describe('getGameMasterJson()', function () {
17
-        it("Should return raw array result", function () {
15
+describe('LevelExtractor', function() {
16
+    describe('getGameMasterJson()', function() {
17
+        it("Should return raw array result", function() {
18 18
             $raw = (new LevelExtractor())->getGameMasterJson();
19 19
 
20 20
             $assert = new Assert();
@@ -24,8 +24,8 @@  discard block
 block discarded – undo
24 24
         });
25 25
     });
26 26
 
27
-    describe('getGameMasterJsonCollection()', function () {
28
-        it("Should return a non empty Illuminate\Collection", function () {
27
+    describe('getGameMasterJsonCollection()', function() {
28
+        it("Should return a non empty Illuminate\Collection", function() {
29 29
             $collection = (new LevelExtractor())->getGameMasterJsonCollection();
30 30
 
31 31
             $assert = new Assert();
@@ -34,8 +34,8 @@  discard block
 block discarded – undo
34 34
         });
35 35
     });
36 36
 
37
-    describe('getDustFiltered(200)', function () {
38
-        it("Should return a non empty Illuminate\Collection", function () {
37
+    describe('getDustFiltered(200)', function() {
38
+        it("Should return a non empty Illuminate\Collection", function() {
39 39
             $collection = (new LevelExtractor())->getDustFiltered(200);
40 40
 
41 41
             $assert = new Assert();
@@ -44,8 +44,8 @@  discard block
 block discarded – undo
44 44
         });
45 45
     });
46 46
 
47
-    describe('getDustFiltered(1)', function () {
48
-        it("Should return an empty Illuminate\Collection", function () {
47
+    describe('getDustFiltered(1)', function() {
48
+        it("Should return an empty Illuminate\Collection", function() {
49 49
             $collection = (new LevelExtractor())->getDustFiltered(1);
50 50
 
51 51
             $assert = new Assert();
Please login to merge, or discard this patch.
tests/Extractors/GameMasterExtractor.spec.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -12,9 +12,9 @@  discard block
 block discarded – undo
12 12
 use Peridot\Leo\Interfaces\Assert;
13 13
 use Th3Mouk\PokemonGoIVCalculator\Extractors\GameMasterExtractor;
14 14
 
15
-describe('GameMasterExtractor', function () {
16
-    describe('getGameMasterJson()', function () {
17
-        it("Should return raw array result", function () {
15
+describe('GameMasterExtractor', function() {
16
+    describe('getGameMasterJson()', function() {
17
+        it("Should return raw array result", function() {
18 18
             $raw = (new GameMasterExtractor())->getGameMasterJson();
19 19
 
20 20
             $assert = new Assert();
@@ -24,8 +24,8 @@  discard block
 block discarded – undo
24 24
         });
25 25
     });
26 26
 
27
-    describe('getGameMasterJsonCollection()', function () {
28
-        it("Should return a non empty Illuminate\Collection", function () {
27
+    describe('getGameMasterJsonCollection()', function() {
28
+        it("Should return a non empty Illuminate\Collection", function() {
29 29
             $collection = (new GameMasterExtractor())->getGameMasterJsonCollection();
30 30
 
31 31
             $assert = new Assert();
Please login to merge, or discard this patch.
tests/Calculator/Calculator.spec.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -14,13 +14,13 @@  discard block
 block discarded – undo
14 14
 use Th3Mouk\PokemonGoIVCalculator\Entities\IvCombinaison;
15 15
 use Th3Mouk\PokemonGoIVCalculator\Entities\Level;
16 16
 
17
-describe('Calculator', function () {
18
-    beforeEach(function () {
17
+describe('Calculator', function() {
18
+    beforeEach(function() {
19 19
         $this->assert = new Assert();
20 20
     });
21 21
 
22
-    describe('calculate()', function () {
23
-        it("test exclusion double 13 IV (max)", function () {
22
+    describe('calculate()', function() {
23
+        it("test exclusion double 13 IV (max)", function() {
24 24
             $bulbasaur = (new Calculator())->calculate(
25 25
                 'bulbasaur', 515, 59, 2500, 4, 3, ['def']
26 26
             );
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
             );
36 36
         });
37 37
 
38
-        it("test double 13 IV (max)", function () {
38
+        it("test double 13 IV (max)", function() {
39 39
             $gengar = (new Calculator())->calculate(
40 40
                 'gengar', 1421, 74, 2500, 3, 3, ['atk', 'def']
41 41
             );
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
             $level = new Level(20, 2500, 0.5974);
44 44
             $combinaison = new IvCombinaison($level, 13, 13, 5);
45 45
 
46
-            $this->assert->equal((int)$gengar->getAveragePerfection()*10, (int)68.9*10);
46
+            $this->assert->equal((int) $gengar->getAveragePerfection() * 10, (int) 68.9 * 10);
47 47
             $this->assert->equal(
48 48
                 $gengar->getIvCombinaisons(),
49 49
                 new Collection([$combinaison])
@@ -51,8 +51,8 @@  discard block
 block discarded – undo
51 51
         });
52 52
     });
53 53
 
54
-    describe('setRanges()', function () {
55
-        it("100% iv pokemon", function () {
54
+    describe('setRanges()', function() {
55
+        it("100% iv pokemon", function() {
56 56
             $calculator = new Calculator();
57 57
             $calculator->calculate(
58 58
                 'mew', 5000, 500, 200, 4, 4, ['atk', 'def', 'hp']
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
             $this->assert->equal($calculator->getStaminaRAnge(), [15]);
64 64
         });
65 65
 
66
-        it("double max iv pokemon", function () {
66
+        it("double max iv pokemon", function() {
67 67
             $calculator = new Calculator();
68 68
             $calculator->calculate(
69 69
                 'mew', 5000, 500, 200, 3, 3, ['atk', 'hp']
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
             $this->assert->equal($calculator->getStaminaRAnge(), range(13, 14));
75 75
         });
76 76
 
77
-        it("normal iv pokemon", function () {
77
+        it("normal iv pokemon", function() {
78 78
             $calculator = new Calculator();
79 79
             $calculator->calculate(
80 80
                 'mew', 5000, 500, 200, 3, 3, ['atk']
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
             $this->assert->equal($calculator->getStaminaRAnge(), range(0, 13));
86 86
         });
87 87
 
88
-        it("0% iv pokemon", function () {
88
+        it("0% iv pokemon", function() {
89 89
             $calculator = new Calculator();
90 90
             $calculator->calculate(
91 91
                 'mew', 5000, 500, 200, 1, 1, ['atk', 'def', 'hp']
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
             $this->assert->equal($calculator->getStaminaRAnge(), range(0, 7));
97 97
         });
98 98
 
99
-        it("check wtf stats values", function () {
99
+        it("check wtf stats values", function() {
100 100
             $calculator = new Calculator();
101 101
             $calculator->calculate(
102 102
                 'mew', -43, 500, 200, 6, 7, ['atk', 'def', 'hp']
Please login to merge, or discard this patch.