Test Setup Failed
Push — master ( 7d0515...d89010 )
by Julien
05:12
created
database/migrations/2014_10_12_000001_alter_lt_users_table.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
     public function up()
15 15
     {
16 16
         if (!Schema::hasTable('users')) {
17
-            Schema::create('users', function (Blueprint $table) {
17
+            Schema::create('users', function(Blueprint $table) {
18 18
                 $table->increments('id');
19 19
                 $table->string('name');
20 20
                 $table->string('firstname')->default('firstname');
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
                 $table->timestamps();
25 25
             });
26 26
         } else {
27
-            Schema::table('users', function (Blueprint $table) {
27
+            Schema::table('users', function(Blueprint $table) {
28 28
                 if (!Schema::hasColumn('users', 'name')) {
29 29
                     $table->string('name')->default('name');
30 30
                 }
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
                     $table->string('lastname')->default('lastname');
36 36
                 }
37 37
                 if (!Schema::hasColumn('users', 'email')) {
38
-                    $table->string('email')->default('user_'.rand(100000, 999999).'@kendozone.com')->unique();
38
+                    $table->string('email')->default('user_' . rand(100000, 999999) . '@kendozone.com')->unique();
39 39
                 }
40 40
 
41 41
                 if (!Schema::hasColumn('users', 'password')) {
Please login to merge, or discard this patch.
src/TreeGen/PlayOffTreeGen.php 1 patch
Doc Comments   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
      *
30 30
      * @param $fightersByEntity
31 31
      *
32
-     * @return mixed
32
+     * @return Collection
33 33
      */
34 34
     protected function chunk(Collection $fightersByEntity)
35 35
     {
@@ -103,6 +103,9 @@  discard block
 block discarded – undo
103 103
         $this->generateGroupsForRound($fighters, 1);
104 104
     }
105 105
 
106
+    /**
107
+     * @param integer $round
108
+     */
106 109
     protected function generateGroupsForRound(Collection $fightersByArea, $round)
107 110
     {
108 111
         $fightersId = $fightersByArea->pluck('id');
Please login to merge, or discard this patch.
src/TreeGen/SingleEliminationTreeGen.php 2 patches
Doc Comments   +8 added lines, -7 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
     /**
60 60
      * Create empty groups after round 1.
61 61
      *
62
-     * @param $numFighters
62
+     * @param integer $numFighters
63 63
      */
64 64
     protected function pushEmptyGroupsToTree($numFighters)
65 65
     {
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
 
163 163
     /**
164 164
      * @param Collection $usersByArea
165
-     * @param $round
165
+     * @param integer $round
166 166
      */
167 167
     public function generateGroupsForRound(Collection $usersByArea, $round)
168 168
     {
@@ -249,10 +249,11 @@  discard block
 block discarded – undo
249 249
     }
250 250
 
251 251
     /**
252
-     * @param $frequency
252
+     * @param integer $frequency
253 253
      * @param $groupSize
254
-     * @param $count
255
-     * @param $byeCount
254
+     * @param integer $count
255
+     * @param integer $byeCount
256
+     * @param integer $numByeTotal
256 257
      *
257 258
      * @return bool
258 259
      */
@@ -293,7 +294,7 @@  discard block
 block discarded – undo
293 294
     /**
294 295
      * Get the biggest entity group.
295 296
      *
296
-     * @param $userGroups
297
+     * @param Collection $userGroups
297 298
      *
298 299
      * @return int
299 300
      */
@@ -311,7 +312,7 @@  discard block
 block discarded – undo
311 312
     /**
312 313
      * Repart BYE in the tree,.
313 314
      *
314
-     * @param $fighterGroups
315
+     * @param Collection $fighterGroups
315 316
      * @param int $max
316 317
      *
317 318
      * @return Collection
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
         $bye = $this->createByeFighter();
227 227
         $groupSize = $this->firstRoundGroupSize();
228 228
         $frequency = $groupSize != 0
229
-            ? (int) floor(count($fighters) / $groupSize / $groupSize)
229
+            ? (int)floor(count($fighters) / $groupSize / $groupSize)
230 230
             : -1;
231 231
         if ($frequency < $groupSize) {
232 232
             $frequency = $groupSize;
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
     private function getMaxFightersByEntity($userGroups): int
306 306
     {
307 307
         return $userGroups
308
-            ->sortByDesc(function ($group) {
308
+            ->sortByDesc(function($group) {
309 309
                 return $group->count();
310 310
             })
311 311
             ->first()
Please login to merge, or discard this patch.
src/TreeGen/TreeGen.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
     protected function getTreeSize($fighterCount, $groupSize)
92 92
     {
93 93
         $squareMultiplied = collect([1, 2, 4, 8, 16, 32, 64])
94
-            ->map(function ($item) use ($groupSize) {
94
+            ->map(function($item) use ($groupSize) {
95 95
                 return $item * $groupSize;
96 96
             }); // [4, 8, 16, 32, 64,...]
97 97
 
@@ -197,10 +197,10 @@  discard block
 block discarded – undo
197 197
     protected function getFightersByArea()
198 198
     {
199 199
         $areas = $this->settings->fightingAreas;
200
-        $fighters = $this->getFighters();   // Get Competitor or Team Objects
201
-        $fighterByEntity = $this->getFightersByEntity($fighters);   // Chunk it by entities (Fede, Assoc, Club,...)
202
-        $fightersWithBye = $this->adjustFightersGroupWithByes($fighters, $fighterByEntity);     // Fill with Byes
203
-        return $fightersWithBye->chunk(count($fightersWithBye) / $areas);   // Chunk user by areas
200
+        $fighters = $this->getFighters(); // Get Competitor or Team Objects
201
+        $fighterByEntity = $this->getFightersByEntity($fighters); // Chunk it by entities (Fede, Assoc, Club,...)
202
+        $fightersWithBye = $this->adjustFightersGroupWithByes($fighters, $fighterByEntity); // Fill with Byes
203
+        return $fightersWithBye->chunk(count($fightersWithBye) / $areas); // Chunk user by areas
204 204
     }
205 205
 
206 206
     /**
Please login to merge, or discard this patch.
Doc Comments   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -21,6 +21,9 @@  discard block
 block discarded – undo
21 21
 
22 22
     abstract protected function generateFights();
23 23
 
24
+    /**
25
+     * @param string|null $fighterToUpdate
26
+     */
24 27
     abstract protected function addFighterToGroup(FightersGroup $group, $fighter, $fighterToUpdate);
25 28
 
26 29
     abstract protected function getByeGroup($fighters);
@@ -82,7 +85,7 @@  discard block
 block discarded – undo
82 85
      * Get the size the first round will have.
83 86
      *
84 87
      * @param $fighterCount
85
-     * @param $groupSize
88
+     * @param integer $groupSize
86 89
      *
87 90
      * @return int
88 91
      */
@@ -200,7 +203,7 @@  discard block
 block discarded – undo
200 203
     /**
201 204
      * Logically build the tree ( attach a parent to every child for nestedSet Navigation ).
202 205
      *
203
-     * @param $numFighters
206
+     * @param integer $numFighters
204 207
      */
205 208
     protected function addParentToChildren($numFighters)
206 209
     {
Please login to merge, or discard this patch.
src/TournamentsServiceProvider.php 2 patches
Doc Comments   -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,6 @@
 block discarded – undo
10 10
     /**
11 11
      * Bootstrap the application services.
12 12
      *
13
-     * @param Router $router
14 13
      *
15 14
      * @return void
16 15
      */
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -16,16 +16,16 @@
 block discarded – undo
16 16
      */
17 17
     public function boot()
18 18
     {
19
-        $viewPath = __DIR__.'/../resources/views';
19
+        $viewPath = __DIR__ . '/../resources/views';
20 20
         $this->loadViewsFrom($viewPath, 'laravel-tournaments');
21 21
 
22
-        $this->loadMigrationsFrom(__DIR__.'/../database/migrations');
23
-        $this->loadTranslationsFrom(__DIR__.'/../translations', 'laravel-tournaments');
22
+        $this->loadMigrationsFrom(__DIR__ . '/../database/migrations');
23
+        $this->loadTranslationsFrom(__DIR__ . '/../translations', 'laravel-tournaments');
24 24
 
25
-        $this->publishes([__DIR__.'/../database/seeds' => $this->app->databasePath().'/seeds'], 'laravel-tournaments');
26
-        $this->publishes([__DIR__.'/../database/factories' => $this->app->databasePath().'/factories'], 'laravel-tournaments');
27
-        $this->publishes([__DIR__.'/../resources/assets' => public_path('vendor/laravel-tournaments')], 'laravel-tournaments');
28
-        $this->publishes([__DIR__.'/../config/laravel-tournaments.php' => config_path('laravel-tournaments.php')], 'laravel-tournaments');
25
+        $this->publishes([__DIR__ . '/../database/seeds' => $this->app->databasePath() . '/seeds'], 'laravel-tournaments');
26
+        $this->publishes([__DIR__ . '/../database/factories' => $this->app->databasePath() . '/factories'], 'laravel-tournaments');
27
+        $this->publishes([__DIR__ . '/../resources/assets' => public_path('vendor/laravel-tournaments')], 'laravel-tournaments');
28
+        $this->publishes([__DIR__ . '/../config/laravel-tournaments.php' => config_path('laravel-tournaments.php')], 'laravel-tournaments');
29 29
     }
30 30
 
31 31
     /**
Please login to merge, or discard this patch.
database/factories/UserFactory.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 
4
-$factory->define(config('laravel-tournaments.user.model'), function (Faker\Generator $faker) {
4
+$factory->define(config('laravel-tournaments.user.model'), function(Faker\Generator $faker) {
5 5
     return [
6 6
         'name'               => $faker->name,
7 7
         'email'              => $faker->unique()->safeEmail,
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
@@ -3,7 +3,7 @@
 block discarded – undo
3 3
 use Xoco70\LaravelTournaments\Models\Championship;
4 4
 use Xoco70\LaravelTournaments\Models\Competitor;
5 5
 
6
-$factory->define(Competitor::class, function (Faker\Generator $faker) {
6
+$factory->define(Competitor::class, function(Faker\Generator $faker) {
7 7
     $tcs = Championship::all()->pluck('id')->toArray();
8 8
     $users = config('laravel-tournaments.user.model')::all()->pluck('id')->toArray();
9 9
     $championshipId = $faker->randomElement($tcs);
Please login to merge, or discard this patch.
database/migrations/2014_11_01_171759_create_lt_Tournament_table.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@
 block discarded – undo
9 9
 {
10 10
     public function up()
11 11
     {
12
-        Schema::create('tournament', function (Blueprint $table) {
12
+        Schema::create('tournament', function(Blueprint $table) {
13 13
             $table->increments('id');
14 14
             //TODO Added ->nullable() to solve FK issue with Sqlite :(
15 15
             $table->bigInteger('user_id')->unsigned()->nullable()->index();
Please login to merge, or discard this patch.
src/TreeGen/CreateSingleEliminationTree.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 
29 29
     public function build()
30 30
     {
31
-        $fighters = $this->groupsByRound->first()->map(function ($item) {
31
+        $fighters = $this->groupsByRound->first()->map(function($item) {
32 32
             $fighters = $item->getFightersWithBye();
33 33
             $fighter1 = $fighters->get(0);
34 34
             $fighter2 = $fighters->get(1);
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
             //The minus 3 is to ignore the final, semi final and quarter final rounds
138 138
 
139 139
             for ($i = 0; $i < $noRounds - 3; $i++) {
140
-                $tempRounds[] = 'Last '.$noTeamsInFirstRound;
140
+                $tempRounds[] = 'Last ' . $noTeamsInFirstRound;
141 141
                 $noTeamsInFirstRound /= 2;
142 142
             }
143 143
 
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
         foreach ($roundTitles as $key => $roundTitle) {
160 160
             $left = $key * ($this->matchWrapperWidth + $this->roundSpacing - 1);
161 161
 
162
-            echo '<div class="round-title" style="left: '.$left.'px;">'.$roundTitle.'</div>';
162
+            echo '<div class="round-title" style="left: ' . $left . 'px;">' . $roundTitle . '</div>';
163 163
         }
164 164
         echo '</div>';
165 165
     }
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
     public function getPlayerList($selected)
173 173
     {
174 174
         $html = '<select>
175
-                <option'.($selected == '' ? ' selected' : '').'></option>';
175
+                <option'.($selected == '' ? ' selected' : '') . '></option>';
176 176
 
177 177
         foreach ($this->championship->fighters as $fighter) {
178 178
             $html = $this->addOptionToSelect($selected, $fighter, $html);
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
     {
233 233
         if ($fighter != null) {
234 234
             $select = $selected != null && $selected->id == $fighter->id ? ' selected' : '';
235
-            $html .= '<option'.$select
235
+            $html .= '<option' . $select
236 236
                 .' value='
237 237
                 .($fighter->id ?? '')
238 238
                 .'>'
Please login to merge, or discard this patch.