Passed
Push — master ( 14ed1b...ecb8e9 )
by Julien
31:40
created
src/models/Championship.php 3 patches
Doc Comments   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 
209 209
     /**
210 210
      * Return Groups that belongs to a round
211
-     * @param $round
211
+     * @param integer $round
212 212
      * @return HasMany
213 213
      */
214 214
     public function groupsByRound($round)
@@ -219,6 +219,7 @@  discard block
 block discarded – undo
219 219
     /**
220 220
      * Return Fights that belongs to a round
221 221
      *
222
+     * @param integer $round
222 223
      * @return \Illuminate\Database\Eloquent\Relations\HasManyThrough
223 224
      */
224 225
     public function fightsByRound($round)
Please login to merge, or discard this patch.
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -6,7 +6,6 @@
 block discarded – undo
6 6
 use Illuminate\Database\Eloquent\Relations\HasMany;
7 7
 use Illuminate\Database\Eloquent\SoftDeletes;
8 8
 use Illuminate\Foundation\Auth\User;
9
-use Illuminate\Support\Collection;
10 9
 
11 10
 class Championship extends Model
12 11
 {
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -24,11 +24,11 @@  discard block
 block discarded – undo
24 24
     {
25 25
         parent::boot();
26 26
 
27
-        static::deleting(function ($championship) {
27
+        static::deleting(function($championship) {
28 28
             $championship->competitors()->delete();
29 29
             $championship->settings()->delete();
30 30
         });
31
-        static::restoring(function ($championship) {
31
+        static::restoring(function($championship) {
32 32
             $championship->competitors()->restore();
33 33
             $championship->settings()->restore();
34 34
         });
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
      */
214 214
     public function groupsByRound($round)
215 215
     {
216
-        return $this->fightersGroups()->where('round',$round);
216
+        return $this->fightersGroups()->where('round', $round);
217 217
     }
218 218
 
219 219
     /**
@@ -223,6 +223,6 @@  discard block
 block discarded – undo
223 223
      */
224 224
     public function fightsByRound($round)
225 225
     {
226
-        return $this->hasManyThrough(Fight::class, FightersGroup::class)->where('round',$round);
226
+        return $this->hasManyThrough(Fight::class, FightersGroup::class)->where('round', $round);
227 227
     }
228 228
 }
Please login to merge, or discard this patch.
src/TreeGen/TreeGen.php 3 patches
Doc Comments   +11 added lines, -6 removed lines patch added patch discarded remove patch
@@ -226,8 +226,10 @@  discard block
 block discarded – undo
226 226
     }
227 227
 
228 228
     /**
229
-     * @param $usersByArea
230
-     * @param $area
229
+     * @param Collection $usersByArea
230
+     * @param integer $area
231
+     * @param integer $round
232
+     * @param integer $shuffle
231 233
      *
232 234
      */
233 235
     public function generateGroupsForRound($usersByArea, $area, $round, $shuffle)
@@ -247,7 +249,7 @@  discard block
 block discarded – undo
247 249
     /**
248 250
      * @param $fighters
249 251
      * @param $area
250
-     * @param $order
252
+     * @param integer $order
251 253
      * @param $round
252 254
      * @return FightersGroup
253 255
      */
@@ -312,6 +314,9 @@  discard block
 block discarded – undo
312 314
             : new Competitor();
313 315
     }
314 316
 
317
+    /**
318
+     * @param integer $groupSize
319
+     */
315 320
     public function createByeGroup($groupSize): Collection
316 321
     {
317 322
         $byeFighter = $this->createByeFighter();
@@ -324,7 +329,7 @@  discard block
 block discarded – undo
324 329
 
325 330
     /**
326 331
      * @param $fighters
327
-     * @param $fighterGroups
332
+     * @param Collection $fighterGroups
328 333
      * @return Collection
329 334
      */
330 335
     public function adjustFightersGroupWithByes($fighters, $fighterGroups): Collection
@@ -359,7 +364,7 @@  discard block
 block discarded – undo
359 364
     /**
360 365
      * Get the next group on the right ( parent ), final round being the ancestor
361 366
      * @param $matchNumber
362
-     * @param $previousRound
367
+     * @param Collection $previousRound
363 368
      * @return mixed
364 369
      */
365 370
     private function getParentGroup($matchNumber, $previousRound)
@@ -371,7 +376,7 @@  discard block
 block discarded – undo
371 376
 
372 377
     /**
373 378
      * Save Groups with their parent info
374
-     * @param $numRounds
379
+     * @param integer $numRounds
375 380
      * @param $numFightersEliminatory
376 381
      */
377 382
     private function pushGroups($numRounds, $numFightersEliminatory, $shuffle = true)
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
     private function getTreeSize($fighterCount, $groupSize)
131 131
     {
132 132
         $square = collect([1, 2, 4, 8, 16, 32, 64]);
133
-        $squareMultiplied = $square->map(function ($item, $key) use ($groupSize) {
133
+        $squareMultiplied = $square->map(function($item, $key) use ($groupSize) {
134 134
             return $item * $groupSize;
135 135
         });
136 136
 
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
     private function getPreviousRound($currentRound)
353 353
     {
354 354
         $previousRound = $this->championship->groupsByRound($currentRound + 1)->get();
355
-        dump("previous". $previousRound->pluck('id'));
355
+        dump("previous" . $previousRound->pluck('id'));
356 356
         return $previousRound;
357 357
     }
358 358
 
Please login to merge, or discard this patch.
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -255,7 +255,9 @@  discard block
 block discarded – undo
255 255
     {
256 256
 
257 257
         $fighters = $fighters->pluck('id');
258
-        if ($shuffle) $fighters->shuffle();
258
+        if ($shuffle) {
259
+            $fighters->shuffle();
260
+        }
259 261
         $group = $this->saveGroup($area, $order, $round, $parent);
260 262
 
261 263
         // Add all competitors to Pivot Table
@@ -417,10 +419,14 @@  discard block
 block discarded – undo
417 419
     {
418 420
         if ($this->championship->hasPreliminary()) {
419 421
             $fightersGroup = $fightersByEntity->chunk($this->settings->preliminaryGroupSize);
420
-            if ($shuffle) $fightersGroup->shuffle();
422
+            if ($shuffle) {
423
+                $fightersGroup->shuffle();
424
+            }
421 425
         } elseif ($this->championship->isDirectEliminationType() || $round > 1) {
422 426
             $fightersGroup = $fightersByEntity->chunk(2);
423
-            if ($shuffle) $fightersGroup->shuffle();
427
+            if ($shuffle) {
428
+                $fightersGroup->shuffle();
429
+            }
424 430
         } else { // Round Robin
425 431
             $fightersGroup = $fightersByEntity->chunk($fightersByEntity->count());
426 432
         }
Please login to merge, or discard this patch.
database/factories/CompetitorFactory.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@
 block discarded – undo
4 4
 use Xoco70\KendoTournaments\Models\Championship;
5 5
 use Xoco70\KendoTournaments\Models\Competitor;
6 6
 
7
-$factory->define(Competitor::class, function (Faker\Generator $faker) {
7
+$factory->define(Competitor::class, function(Faker\Generator $faker) {
8 8
     $tcs = Championship::all()->pluck('id')->toArray();
9 9
     $users = User::all()->pluck('id')->toArray();
10 10
     $championshipId = $faker->randomElement($tcs);
Please login to merge, or discard this patch.
src/TreeController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@
 block discarded – undo
51 51
         DB::table('fighters_group_competitor')->delete();
52 52
         DB::table('fighters_group_team')->delete();
53 53
         DB::table('competitor')->delete();
54
-        DB::table('users')->where('id','<>',1)->delete();
54
+        DB::table('users')->where('id', '<>', 1)->delete();
55 55
 
56 56
         $championship = Championship::with('teams', 'users', 'category', 'settings')->find($championship->id);
57 57
         $numFighters = $request->numFighters;
Please login to merge, or discard this patch.
src/models/Fight.php 1 patch
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -289,9 +289,15 @@
 block discarded – undo
289 289
      */
290 290
     public function getValueToUpdate()
291 291
     {
292
-        if ($this->c1 != null && $this->c2 != null) return null;
293
-        if ($this->c1 != null) return "c1";
294
-        if ($this->c2 != null) return "c2";
292
+        if ($this->c1 != null && $this->c2 != null) {
293
+            return null;
294
+        }
295
+        if ($this->c1 != null) {
296
+            return "c1";
297
+        }
298
+        if ($this->c2 != null) {
299
+            return "c2";
300
+        }
295 301
         return null;
296 302
     }
297 303
 }
298 304
\ No newline at end of file
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
@@ -206,7 +206,7 @@
 block discarded – undo
206 206
             foreach ($fightsByRound as $numFight => $fight) {
207 207
 
208 208
                 $parentGroup = $fight->group->parent;
209
-                if ($parentGroup == null ) break;
209
+                if ($parentGroup == null) break;
210 210
                 $parentFight = $parentGroup->fights->get(0);
211 211
 
212 212
                 // IN this $fight, if it is the first child or the second child --> c1 or c2 in parent
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -206,7 +206,9 @@
 block discarded – undo
206 206
             foreach ($fightsByRound as $numFight => $fight) {
207 207
 
208 208
                 $parentGroup = $fight->group->parent;
209
-                if ($parentGroup == null ) break;
209
+                if ($parentGroup == null ) {
210
+                    break;
211
+                }
210 212
                 $parentFight = $parentGroup->fights->get(0);
211 213
 
212 214
                 // IN this $fight, if it is the first child or the second child --> c1 or c2 in parent
Please login to merge, or discard this patch.
src/TreeGen/DirectEliminationTreeGen.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@
 block discarded – undo
25 25
         $this->championship = $championship;
26 26
         $this->names = $names;
27 27
 
28
-        $this->firstRoundName = $names->first()->map(function ($item) use ($championship) {
28
+        $this->firstRoundName = $names->first()->map(function($item) use ($championship) {
29 29
             $fighters = $item->getFighters();
30 30
             $fighter1 = $fighters->get(0);
31 31
             $fighter2 = $fighters->get(1);
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -53,7 +53,9 @@
 block discarded – undo
53 53
         $matches = array_chunk($fighters, 2);
54 54
 
55 55
         //If there's already a match in the match array, then that means the next round is round 2, so increase the round number
56
-        if (count($this->brackets)) $roundNumber++;
56
+        if (count($this->brackets)) {
57
+            $roundNumber++;
58
+        }
57 59
 
58 60
         $countMatches = count($matches);
59 61
         //Create the first full round of fighters, some may be blank if waiting on the results of a previous round
Please login to merge, or discard this patch.