Passed
Push — master ( 65aca6...005c56 )
by Julien
09:06 queued 04:36
created
src/TreeGen/TreeGen.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -392,7 +392,9 @@
 block discarded – undo
392 392
     {
393 393
         foreach ($groupsByRound as $keyGroup => $group) {
394 394
             $parentGroup = $group->parent;
395
-            if ($parentGroup == null) break;
395
+            if ($parentGroup == null) {
396
+                break;
397
+            }
396 398
             $parentFight = $parentGroup->fights->get(0);
397 399
 
398 400
             // determine whether c1 or c2 must be updated
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
     private function getMaxFightersByEntity($userGroups): int
80 80
     {
81 81
         return $userGroups
82
-            ->sortByDesc(function ($group) {
82
+            ->sortByDesc(function($group) {
83 83
                 return $group->count();
84 84
             })
85 85
             ->first()
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
     protected function getTreeSize($fighterCount, $groupSize)
118 118
     {
119 119
         $squareMultiplied = collect([1, 2, 4, 8, 16, 32, 64])
120
-            ->map(function ($item) use ($groupSize) {
120
+            ->map(function($item) use ($groupSize) {
121 121
                 return $item * $groupSize;
122 122
             }); // [4, 8, 16, 32, 64,...]
123 123
 
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
             throw new TreeGenerationException(trans('msg.min_competitor_required', ['number' => config('laravel-tournaments.MIN_COMPETITORS_X_AREA')]));
303 303
         }
304 304
 
305
-        if ($this->settings->hasPreliminary && $fighters->count() / ($this->settings->preliminaryGroupSize * $areas) < 1 ) {
305
+        if ($this->settings->hasPreliminary && $fighters->count() / ($this->settings->preliminaryGroupSize * $areas) < 1) {
306 306
             throw new TreeGenerationException(trans('msg.min_competitor_required', ['number' => config('laravel-tournaments.MIN_COMPETITORS_X_AREA')]));
307 307
         }
308 308
 
Please login to merge, or discard this patch.
src/models/FightersGroup.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -180,7 +180,7 @@
 block discarded – undo
180 180
     public function hasDeterminedParent()
181 181
     {
182 182
         // There is more than 1 fight, should be Preliminary
183
-        if (sizeof($this->fighters()) > 1){
183
+        if (sizeof($this->fighters()) > 1) {
184 184
             return false;
185 185
         }
186 186
         foreach ($this->children as $child) {
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -184,7 +184,9 @@
 block discarded – undo
184 184
             return false;
185 185
         }
186 186
         foreach ($this->children as $child) {
187
-            if (sizeof($child->fighters()) > 1) return false;
187
+            if (sizeof($child->fighters()) > 1) {
188
+                return false;
189
+            }
188 190
         }
189 191
         return true;
190 192
 
Please login to merge, or discard this patch.
src/TreeGen/CreateDirectEliminationTree.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@
 block discarded – undo
26 26
         $this->groupsByRound = $groupsByRound;
27 27
         $this->hasPreliminary = $hasPreliminary;
28 28
 
29
-        $this->firstRoundName = $groupsByRound->first()->map(function ($item) use ($championship) {
29
+        $this->firstRoundName = $groupsByRound->first()->map(function($item) use ($championship) {
30 30
             $fighters = $item->getFightersWithBye();
31 31
             $fighter1 = $fighters->get(0);
32 32
             $fighter2 = $fighters->get(1);
Please login to merge, or discard this patch.
src/TreeController.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@
 block discarded – undo
41 41
      *
42 42
      * @param Request $request
43 43
      *
44
-     * @return \Illuminate\Http\Response|string
44
+     * @return \Illuminate\Http\RedirectResponse
45 45
      */
46 46
     public function store(Request $request, $championshipId)
47 47
     {
Please login to merge, or discard this patch.
resources/views/partials/tree/brackets/playerList.blade.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@
 block discarded – undo
1 1
 <?php
2 2
 $prefix = "directElimination";
3
-if ($championship->hasPreliminary() && $numRound ==1){
3
+if ($championship->hasPreliminary() && $numRound == 1) {
4 4
     $prefix = "preliminary";
5 5
 }
6
-$className = $prefix."_select";
7
-$selectName = $prefix."_fighters[]";
6
+$className = $prefix . "_select";
7
+$selectName = $prefix . "_fighters[]";
8 8
 ?>
9 9
 <select name="{{ $selectName }}" class={{$className}}>
10 10
     <option {{ $selected == '' ? ' selected' : '' }} ></option>
Please login to merge, or discard this patch.
src/models/Fight.php 1 patch
Braces   +15 added lines, -5 removed lines patch added patch discarded remove patch
@@ -44,7 +44,9 @@  discard block
 block discarded – undo
44 44
      */
45 45
     protected static function getFightersWithByes(FightersGroup $group)
46 46
     {
47
-        if ($group == null) return null;
47
+        if ($group == null) {
48
+            return null;
49
+        }
48 50
         $fighters = $group->getFightersWithBye();
49 51
         $fighterType = $group->getFighterType();
50 52
         if (sizeof($fighters) == 0) {
@@ -127,9 +129,15 @@  discard block
 block discarded – undo
127 129
      */
128 130
     public function shouldBeInFightList()
129 131
     {
130
-        if ($this->belongsToFirstRound() && $this->dontHave2Fighters()) return false;
131
-        if (!$this->belongsToFirstRound() && $this->dontHave0Fighters()) return true;
132
-        if ($this->has2Fighters()) return true;
132
+        if ($this->belongsToFirstRound() && $this->dontHave2Fighters()) {
133
+            return false;
134
+        }
135
+        if (!$this->belongsToFirstRound() && $this->dontHave0Fighters()) {
136
+            return true;
137
+        }
138
+        if ($this->has2Fighters()) {
139
+            return true;
140
+        }
133 141
         // We aint in the first round, and there is 1 or 0 competitor
134 142
         // We check children, and see :
135 143
         // if there is 2  - 2 fighters -> undetermine, we cannot add it to fight list
@@ -158,7 +166,9 @@  discard block
 block discarded – undo
158 166
     private function belongsToFirstRound()
159 167
     {
160 168
         $firstRoundFights = $this->group->championship->firstRoundFights->pluck('id')->toArray();
161
-        if (in_array($this->id, $firstRoundFights)) return true;
169
+        if (in_array($this->id, $firstRoundFights)) {
170
+            return true;
171
+        }
162 172
         return false;
163 173
     }
164 174
 
Please login to merge, or discard this patch.
src/Models/DirectEliminationFight.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -7,12 +7,12 @@
 block discarded – undo
7 7
     public function __construct(Fight $fight = null)
8 8
     {
9 9
         parent::__construct();
10
-        if ($fight!=null){
11
-            $this->id= $fight->id;
12
-            $this->short_id= $fight->short_id;
13
-            $this->fighters_group_id= $fight->fighters_group_id;
14
-            $this->c1= $fight->c1;
15
-            $this->c2= $fight->c2;
10
+        if ($fight != null) {
11
+            $this->id = $fight->id;
12
+            $this->short_id = $fight->short_id;
13
+            $this->fighters_group_id = $fight->fighters_group_id;
14
+            $this->c1 = $fight->c1;
15
+            $this->c2 = $fight->c2;
16 16
         }
17 17
     }
18 18
     /**
Please login to merge, or discard this patch.
src/Models/PreliminaryFight.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -10,12 +10,12 @@
 block discarded – undo
10 10
     public function __construct(Fight $fight = null)
11 11
     {
12 12
         parent::__construct();
13
-        if ($fight!=null){
14
-            $this->id= $fight->id;
15
-            $this->short_id= $fight->short_id;
16
-            $this->fighters_group_id= $fight->fighters_group_id;
17
-            $this->c1= $fight->c1;
18
-            $this->c2= $fight->c2;
13
+        if ($fight != null) {
14
+            $this->id = $fight->id;
15
+            $this->short_id = $fight->short_id;
16
+            $this->fighters_group_id = $fight->fighters_group_id;
17
+            $this->c1 = $fight->c1;
18
+            $this->c2 = $fight->c2;
19 19
         }
20 20
     }
21 21
 
Please login to merge, or discard this patch.
src/TreeGen/PlayOffTreeGen.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@
 block discarded – undo
39 39
     /**
40 40
      * Chunk Fighters into groups for fighting, and optionnaly shuffle
41 41
      * @param $fightersByEntity
42
-     * @return mixed
42
+     * @return Collection
43 43
      */
44 44
     protected function chunkAndShuffle(Collection $fightersByEntity)
45 45
     {
Please login to merge, or discard this patch.