Passed
Push — master ( 14ed1b...ecb8e9 )
by Julien
31:40
created
src/models/Competitor.php 1 patch
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -86,15 +86,23 @@
 block discarded – undo
86 86
 
87 87
     public function getName()
88 88
     {
89
-        if ($this == null) return "BYE";
90
-        if ($this->user == null) return "BYE";
89
+        if ($this == null) {
90
+            return "BYE";
91
+        }
92
+        if ($this->user == null) {
93
+            return "BYE";
94
+        }
91 95
         return $this->user->name;
92 96
     }
93 97
 
94 98
     public function getFullName()
95 99
     {
96
-        if ($this == null) return "BYE";
97
-        if ($this->user == null) return "BYE";
100
+        if ($this == null) {
101
+            return "BYE";
102
+        }
103
+        if ($this->user == null) {
104
+            return "BYE";
105
+        }
98 106
         return $this->user->firstname . " " . $this->user->lastname;
99 107
     }
100 108
 
Please login to merge, or discard this patch.
src/TournamentsServiceProvider.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -16,18 +16,18 @@
 block discarded – undo
16 16
      */
17 17
     public function boot(Router $router)
18 18
     {
19
-        $viewPath = __DIR__.'/../resources/views';
19
+        $viewPath = __DIR__ . '/../resources/views';
20 20
         $this->loadViewsFrom($viewPath, 'kendo-tournaments');
21 21
 
22
-        $this->loadMigrationsFrom(__DIR__.'/../database/migrations');
23
-        $this->loadTranslationsFrom(__DIR__.'/../translations', 'kendo-tournaments');
22
+        $this->loadMigrationsFrom(__DIR__ . '/../database/migrations');
23
+        $this->loadTranslationsFrom(__DIR__ . '/../translations', 'kendo-tournaments');
24 24
 
25
-        $this->publishes([__DIR__.'/../database/migrations' => $this->app->databasePath().'/migrations'], 'migrations');
26
-        $this->publishes([__DIR__.'/../database/seeds' => $this->app->databasePath().'/seeds'], 'seeds');
27
-        $this->publishes([__DIR__.'/../database/factories' => $this->app->databasePath().'/factories'], 'seeds');
28
-        $this->publishes([__DIR__.'/../resources/assets' => public_path('vendor/kendo-tournaments')], 'assets');
25
+        $this->publishes([__DIR__ . '/../database/migrations' => $this->app->databasePath() . '/migrations'], 'migrations');
26
+        $this->publishes([__DIR__ . '/../database/seeds' => $this->app->databasePath() . '/seeds'], 'seeds');
27
+        $this->publishes([__DIR__ . '/../database/factories' => $this->app->databasePath() . '/factories'], 'seeds');
28
+        $this->publishes([__DIR__ . '/../resources/assets' => public_path('vendor/kendo-tournaments')], 'assets');
29 29
 
30
-        $router->group(['prefix' => 'kendo-tournaments', 'middleware' => ['web']], function ($router) {
30
+        $router->group(['prefix' => 'kendo-tournaments', 'middleware' => ['web']], function($router) {
31 31
             $router->get('/', 'Xoco70\KendoTournaments\TreeController@index')->name('tree.index');
32 32
             $router->post('/championships/{championship}/trees', 'Xoco70\KendoTournaments\TreeController@store')->name('tree.store');
33 33
         });
Please login to merge, or discard this patch.
database/migrations/2016_11_23_125509_create_Fight_table.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
      */
14 14
     public function up()
15 15
     {
16
-        Schema::create('fight', function (Blueprint $table) {
16
+        Schema::create('fight', function(Blueprint $table) {
17 17
             $table->increments('id');
18 18
             $table->integer('short_id')->unsigned()->nullable();
19 19
             $table->integer('fighters_group_id')->unsigned()->index();
Please login to merge, or discard this patch.
database/migrations/2015_12_03_230346_create_Category_table.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
      */
13 13
     public function up()
14 14
     {
15
-        Schema::create('category', function (Blueprint $table) {
15
+        Schema::create('category', function(Blueprint $table) {
16 16
             $table->increments('id');
17 17
             $table->string('name');
18 18
             $table->string('gender')->nullable();
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
             $table->engine = 'InnoDB';
29 29
         });
30 30
 
31
-        Schema::create('championship', function (Blueprint $table) {
31
+        Schema::create('championship', function(Blueprint $table) {
32 32
             $table->increments('id');
33 33
             $table->integer('tournament_id')->unsigned()->index();
34 34
             $table->integer('category_id')->unsigned()->index();
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
             $table->engine = 'InnoDB';
51 51
         });
52 52
 
53
-        Schema::create('competitor', function (Blueprint $table) {
53
+        Schema::create('competitor', function(Blueprint $table) {
54 54
             $table->increments('id');
55 55
             $table->integer('short_id')->unsigned()->nullable();
56 56
             $table->integer('championship_id')->unsigned()->index();
Please login to merge, or discard this patch.
database/migrations/2016_10_24_223706_create_FightersGroup_table.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
      */
14 14
     public function up()
15 15
     {
16
-        Schema::create('fighters_groups', function (Blueprint $table) {
16
+        Schema::create('fighters_groups', function(Blueprint $table) {
17 17
             $table->increments('id');
18 18
             $table->tinyInteger('short_id')->unsigned()->nullable();
19 19
             $table->integer('championship_id')->unsigned()->index();
Please login to merge, or discard this patch.
resources/views/partials/tree/preliminary.blade.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 block discarded – undo
1 1
 <?php
2
-  $settings = $championship->getSettings();
2
+    $settings = $championship->getSettings();
3 3
 ?>
4 4
 <div align="center">
5 5
     @if (Request::is('championships/'.$championship->id.'/pdf'))
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.