Completed
Push — master ( 9fe9e2...c60305 )
by Vincenzo
04:53 queued 02:24
created
api/Lib/DsManager/Models/Orm/Player.php 1 patch
Indentation   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -9,70 +9,70 @@
 block discarded – undo
9 9
 class Player extends DsManagerOrm
10 10
 {
11 11
 
12
-    /**
13
-     * @var string
14
-     */
15
-    protected $table = 'players';
12
+	/**
13
+	 * @var string
14
+	 */
15
+	protected $table = 'players';
16 16
 
17
-    /**
18
-     * @var array
19
-     */
20
-    protected $fillable = [
21
-        'name',
22
-        'surname',
23
-        'age',
24
-        'nationality',
25
-        'skillAvg',
26
-        'wageReq',
27
-        'val',
28
-        'role',
29
-        'team_id'
30
-    ];
17
+	/**
18
+	 * @var array
19
+	 */
20
+	protected $fillable = [
21
+		'name',
22
+		'surname',
23
+		'age',
24
+		'nationality',
25
+		'skillAvg',
26
+		'wageReq',
27
+		'val',
28
+		'role',
29
+		'team_id'
30
+	];
31 31
 
32
-    /**
33
-     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
34
-     */
35
-    public function team()
36
-    {
37
-        return $this->belongsTo(Team::class);
38
-    }
32
+	/**
33
+	 * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
34
+	 */
35
+	public function team()
36
+	{
37
+		return $this->belongsTo(Team::class);
38
+	}
39 39
 
40
-    public function lastMatches()
41
-    {
42
-        return $this->hasMany(MatchPlayer::class)
43
-            ->orderBy('updated_at', 'DESC')
44
-            ->limit(5);
45
-    }
40
+	public function lastMatches()
41
+	{
42
+		return $this->hasMany(MatchPlayer::class)
43
+			->orderBy('updated_at', 'DESC')
44
+			->limit(5);
45
+	}
46 46
 
47
-    public function goals()
48
-    {
49
-        return $this->hasOne(MatchPlayer::class)
50
-            ->selectRaw('player_id, sum(goals) as count')
51
-            ->groupBy('player_id');
52
-    }
47
+	public function goals()
48
+	{
49
+		return $this->hasOne(MatchPlayer::class)
50
+			->selectRaw('player_id, sum(goals) as count')
51
+			->groupBy('player_id');
52
+	}
53 53
 
54
-    public function appearances()
55
-    {
56
-        return $this->hasOne(MatchPlayer::class)
57
-            ->selectRaw('player_id, count(match_id) as count')
58
-            ->groupBy('player_id');
59
-    }
54
+	public function appearances()
55
+	{
56
+		return $this->hasOne(MatchPlayer::class)
57
+			->selectRaw('player_id, count(match_id) as count')
58
+			->groupBy('player_id');
59
+	}
60 60
 
61
-    public function avg()
62
-    {
63
-        return $this->hasOne(MatchPlayer::class)
64
-            ->selectRaw('player_id, round(avg(vote),2) as avg')
65
-            ->groupBy('player_id');
66
-    }
61
+	public function avg()
62
+	{
63
+		return $this->hasOne(MatchPlayer::class)
64
+			->selectRaw('player_id, round(avg(vote),2) as avg')
65
+			->groupBy('player_id');
66
+	}
67 67
 
68
-    public function scopeStatistics($query)
69
-    {
70
-        return $query->with(
71
-            'goals',
72
-            'appearances',
73
-            'avg',
74
-            'lastMatches',
75
-            'team'
76
-        );
77
-    }
68
+	public function scopeStatistics($query)
69
+	{
70
+		return $query->with(
71
+			'goals',
72
+			'appearances',
73
+			'avg',
74
+			'lastMatches',
75
+			'team'
76
+		);
77
+	}
78 78
 }
79 79
\ No newline at end of file
Please login to merge, or discard this patch.
api/database/migrations/CreateLeaguesTable.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
     public function run()
14 14
     {
15 15
         Capsule::schema()->dropIfExists('leagues');
16
-        Capsule::schema()->create('leagues', function (Blueprint $table) {
16
+        Capsule::schema()->create('leagues', function(Blueprint $table) {
17 17
             $table->increments('id');
18 18
             $table->string('name');
19 19
             $table->timestamps();
Please login to merge, or discard this patch.
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -5,19 +5,19 @@
 block discarded – undo
5 5
 
6 6
 class CreateLeaguesTable
7 7
 {
8
-    /**
9
-     * Run the migrations.
10
-     *
11
-     * @return void
12
-     */
13
-    public function run()
14
-    {
15
-        Capsule::schema()->dropIfExists('leagues');
16
-        Capsule::schema()->create('leagues', function (Blueprint $table) {
17
-            $table->increments('id');
18
-            $table->string('name');
19
-            $table->unsignedTinyInteger('teams')->default(2);
20
-            $table->timestamps();
21
-        });
22
-    }
8
+	/**
9
+	 * Run the migrations.
10
+	 *
11
+	 * @return void
12
+	 */
13
+	public function run()
14
+	{
15
+		Capsule::schema()->dropIfExists('leagues');
16
+		Capsule::schema()->create('leagues', function (Blueprint $table) {
17
+			$table->increments('id');
18
+			$table->string('name');
19
+			$table->unsignedTinyInteger('teams')->default(2);
20
+			$table->timestamps();
21
+		});
22
+	}
23 23
 }
Please login to merge, or discard this patch.
api/database/seeds/A000TeamsSeeder.php 1 patch
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -3,20 +3,20 @@
 block discarded – undo
3 3
 
4 4
 class ATeamsSeeder
5 5
 {
6
-    function run()
7
-    {
8
-        $teamNumber = 16;
9
-        $rndFiller = new \App\Lib\DsManager\Helpers\RandomFiller();
10
-        for ($i = 1; $i <= $teamNumber; $i++) {
11
-            $team = $rndFiller->getTeam($rndFiller->getLocale());
12
-            $teamArray = $team->toArray();
13
-            $teamO = \App\Lib\DsManager\Models\Orm\Team::create($teamArray);
14
-            foreach ($teamArray['roster'] as $player) {
15
-                $player['team_id'] = $teamO->id;
16
-                \App\Lib\DsManager\Models\Orm\Player::create($player);
17
-            }
18
-            $teamArray['coach']['team_id'] = $teamO->id;
19
-            \App\Lib\DsManager\Models\Orm\Coach::create($teamArray['coach']);
20
-        }
21
-    }
6
+	function run()
7
+	{
8
+		$teamNumber = 16;
9
+		$rndFiller = new \App\Lib\DsManager\Helpers\RandomFiller();
10
+		for ($i = 1; $i <= $teamNumber; $i++) {
11
+			$team = $rndFiller->getTeam($rndFiller->getLocale());
12
+			$teamArray = $team->toArray();
13
+			$teamO = \App\Lib\DsManager\Models\Orm\Team::create($teamArray);
14
+			foreach ($teamArray['roster'] as $player) {
15
+				$player['team_id'] = $teamO->id;
16
+				\App\Lib\DsManager\Models\Orm\Player::create($player);
17
+			}
18
+			$teamArray['coach']['team_id'] = $teamO->id;
19
+			\App\Lib\DsManager\Models\Orm\Coach::create($teamArray['coach']);
20
+		}
21
+	}
22 22
 }
23 23
\ No newline at end of file
Please login to merge, or discard this patch.
api/index.php 3 patches
Unused Use Statements   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -4,9 +4,9 @@
 block discarded – undo
4 4
 require_once("vendor/autoload.php");
5 5
 
6 6
 
7
-use App\Lib\DsManager\Helpers\MatchSimulator;
8
-use App\Lib\DsManager\Models\Orm\League;
9
-use App\Lib\DsManager\Models\Orm\Match;
7
+use App\Lib\DsManager\Helpers\MatchSimulator;
8
+use App\Lib\DsManager\Models\Orm\League;
9
+use App\Lib\DsManager\Models\Orm\Match;
10 10
 use App\Lib\DsManager\Models\Orm\MatchResult;
11 11
 use \App\Lib\Helpers\Responder;
12 12
 use \App\Lib\DsManager\Models\Orm\Player;
Please login to merge, or discard this patch.
Indentation   +121 added lines, -121 removed lines patch added patch discarded remove patch
@@ -14,179 +14,179 @@
 block discarded – undo
14 14
 use \App\Lib\DsManager\Models\Orm\Coach;
15 15
 
16 16
 $configuration = [
17
-    'settings' => [
18
-        'displayErrorDetails' => true,
19
-    ],
17
+	'settings' => [
18
+		'displayErrorDetails' => true,
19
+	],
20 20
 ];
21 21
 $c = new \Slim\Container($configuration);
22 22
 $api = new \Slim\App($c);
23 23
 
24 24
 $api->get('/ping', function ($request, $response, $args) {
25
-    $jsonResp = json_encode(
26
-        [
27
-            "status" => "service up",
28
-            "message" => "in a bottle"
29
-        ]
30
-    );
31
-    return Responder::getJsonResponse($jsonResp, $response);
25
+	$jsonResp = json_encode(
26
+		[
27
+			"status" => "service up",
28
+			"message" => "in a bottle"
29
+		]
30
+	);
31
+	return Responder::getJsonResponse($jsonResp, $response);
32 32
 });
33 33
 
34 34
 $api->get('/players', function ($request, $response, $args) {
35
-    $json = json_encode(Player::all());
36
-    return Responder::getJsonResponse($json, $response);
35
+	$json = json_encode(Player::all());
36
+	return Responder::getJsonResponse($json, $response);
37 37
 });
38 38
 
39 39
 
40 40
 $api->get('/players/{id}', function ($request, $response, $args) {
41
-    return Responder::getJsonResponse(
42
-        Player::findOrFail($args['id']),
43
-        $response
44
-    );
41
+	return Responder::getJsonResponse(
42
+		Player::findOrFail($args['id']),
43
+		$response
44
+	);
45 45
 });
46 46
 
47 47
 $api->get('/coaches', function ($request, $response, $args) {
48
-    return Responder::getJsonResponse(
49
-        Coach::all(),
50
-        $response
51
-    );
48
+	return Responder::getJsonResponse(
49
+		Coach::all(),
50
+		$response
51
+	);
52 52
 });
53 53
 
54 54
 $api->get('/teams', function ($request, $response, $args) {
55
-    return Responder::getJsonResponse(
56
-        Team::all(),
57
-        $response
58
-    );
55
+	return Responder::getJsonResponse(
56
+		Team::all(),
57
+		$response
58
+	);
59 59
 });
60 60
 
61 61
 $api->get('/teams/{id}', function ($request, $response, $args) {
62
-    return Responder::getJsonResponse(
63
-        Team::complete()
64
-            ->where(
65
-                [
66
-                    'id' => $args['id']
67
-                ]
68
-            )->get(),
69
-        $response
70
-    );
62
+	return Responder::getJsonResponse(
63
+		Team::complete()
64
+			->where(
65
+				[
66
+					'id' => $args['id']
67
+				]
68
+			)->get(),
69
+		$response
70
+	);
71 71
 });
72 72
 
73 73
 $api->get('/teams/{id}/players', function ($request, $response, $args) {
74
-    return Responder::getJsonResponse(
75
-        Team::with(
76
-            'roster'
77
-        )->where(
78
-            [
79
-                'id' => $args['id']
80
-            ]
81
-        )->get(),
82
-        $response
83
-    );
74
+	return Responder::getJsonResponse(
75
+		Team::with(
76
+			'roster'
77
+		)->where(
78
+			[
79
+				'id' => $args['id']
80
+			]
81
+		)->get(),
82
+		$response
83
+	);
84 84
 });
85 85
 
86 86
 $api->get('/teams/{id}/players/{playerId}', function ($request, $response, $args) {
87
-    return Responder::getJsonResponse(
88
-        Player::statistics()->where(
89
-            [
90
-                'id' => $args['playerId'],
91
-                'team_id' => $args['id']
92
-            ]
93
-        )->get(),
94
-        $response
95
-    );
87
+	return Responder::getJsonResponse(
88
+		Player::statistics()->where(
89
+			[
90
+				'id' => $args['playerId'],
91
+				'team_id' => $args['id']
92
+			]
93
+		)->get(),
94
+		$response
95
+	);
96 96
 });
97 97
 
98 98
 $api->get('/teams/{id}/coach', function ($request, $response, $args) {
99
-    return Responder::getJsonResponse(
100
-        Team::with(
101
-            'coach'
102
-        )->where(
103
-            [
104
-                'id' => $args['id']
105
-            ]
106
-        )->get(),
107
-        $response
108
-    );
99
+	return Responder::getJsonResponse(
100
+		Team::with(
101
+			'coach'
102
+		)->where(
103
+			[
104
+				'id' => $args['id']
105
+			]
106
+		)->get(),
107
+		$response
108
+	);
109 109
 });
110 110
 
111 111
 $api->get('/leagues', function ($request, $response, $args) {
112
-    return Responder::getJsonResponse(
113
-        League::all(),
114
-        $response
115
-    );
112
+	return Responder::getJsonResponse(
113
+		League::all(),
114
+		$response
115
+	);
116 116
 });
117 117
 
118 118
 $api->get('/leagues/{id}', function ($request, $response, $args) {
119
-    return Responder::getJsonResponse(
120
-        League::with('rounds')
121
-            ->where(
122
-                [
123
-                    'id' => $args['id']
124
-                ]
125
-            )->first(),
126
-        $response
127
-    );
119
+	return Responder::getJsonResponse(
120
+		League::with('rounds')
121
+			->where(
122
+				[
123
+					'id' => $args['id']
124
+				]
125
+			)->first(),
126
+		$response
127
+	);
128 128
 });
129 129
 $api->get('/leagues/{id}/rounds/{roundId}/matches', function ($request, $response, $args) {
130
-    return Responder::getJsonResponse(
131
-        Match::teams()
132
-            ->where(
133
-                [
134
-                    'league_round_id' => $args['roundId'],
135
-                ]
136
-            )->get(),
137
-        $response
138
-    );
130
+	return Responder::getJsonResponse(
131
+		Match::teams()
132
+			->where(
133
+				[
134
+					'league_round_id' => $args['roundId'],
135
+				]
136
+			)->get(),
137
+		$response
138
+	);
139 139
 });
140 140
 $api->get('/matches', function ($request, $response, $args) {
141
-    return Responder::getJsonResponse(
142
-        Match::teams()->get(),
143
-        $response
144
-    );
141
+	return Responder::getJsonResponse(
142
+		Match::teams()->get(),
143
+		$response
144
+	);
145 145
 });
146 146
 
147 147
 $api->post('/matches', function ($request, $response, $args) {
148
-    $json = $request->getBody();
149
-    $json = json_decode($json, true);
150
-    return Responder::getJsonResponse(
151
-        Match::create(
152
-            $json
153
-        ),
154
-        $response
155
-    );
148
+	$json = $request->getBody();
149
+	$json = json_decode($json, true);
150
+	return Responder::getJsonResponse(
151
+		Match::create(
152
+			$json
153
+		),
154
+		$response
155
+	);
156 156
 });
157 157
 
158 158
 $api->get('/matches/{id}', function ($request, $response, $args) {
159
-    return Responder::getJsonResponse(
160
-        Match::complete()
161
-            ->where(
162
-                [
163
-                    'id' => $args['id']
164
-                ]
165
-            )->first(),
166
-        $response
167
-    );
159
+	return Responder::getJsonResponse(
160
+		Match::complete()
161
+			->where(
162
+				[
163
+					'id' => $args['id']
164
+				]
165
+			)->first(),
166
+		$response
167
+	);
168 168
 });
169 169
 
170 170
 $api->get('/matches/{id}/result', function ($request, $response, $args) {
171
-    $result = MatchResult::complete()
172
-        ->where(
173
-            [
174
-                'id' => $args['id']
175
-            ]
176
-        )->first();
171
+	$result = MatchResult::complete()
172
+		->where(
173
+			[
174
+				'id' => $args['id']
175
+			]
176
+		)->first();
177 177
 
178
-    return Responder::getJsonResponse(
179
-        $result,
180
-        $response
181
-    );
178
+	return Responder::getJsonResponse(
179
+		$result,
180
+		$response
181
+	);
182 182
 });
183 183
 
184 184
 $api->put('/matches/{id}/simulate', function ($request, $response, $args) {
185
-    return Responder::getJsonResponse(
186
-        MatchSimulator::simulate(
187
-            $args['id']
188
-        ),
189
-        $response
190
-    );
185
+	return Responder::getJsonResponse(
186
+		MatchSimulator::simulate(
187
+			$args['id']
188
+		),
189
+		$response
190
+	);
191 191
 });
192 192
 $api->run();
193 193
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 $c = new \Slim\Container($configuration);
22 22
 $api = new \Slim\App($c);
23 23
 
24
-$api->get('/ping', function ($request, $response, $args) {
24
+$api->get('/ping', function($request, $response, $args) {
25 25
     $jsonResp = json_encode(
26 26
         [
27 27
             "status" => "service up",
@@ -31,34 +31,34 @@  discard block
 block discarded – undo
31 31
     return Responder::getJsonResponse($jsonResp, $response);
32 32
 });
33 33
 
34
-$api->get('/players', function ($request, $response, $args) {
34
+$api->get('/players', function($request, $response, $args) {
35 35
     $json = json_encode(Player::all());
36 36
     return Responder::getJsonResponse($json, $response);
37 37
 });
38 38
 
39 39
 
40
-$api->get('/players/{id}', function ($request, $response, $args) {
40
+$api->get('/players/{id}', function($request, $response, $args) {
41 41
     return Responder::getJsonResponse(
42 42
         Player::findOrFail($args['id']),
43 43
         $response
44 44
     );
45 45
 });
46 46
 
47
-$api->get('/coaches', function ($request, $response, $args) {
47
+$api->get('/coaches', function($request, $response, $args) {
48 48
     return Responder::getJsonResponse(
49 49
         Coach::all(),
50 50
         $response
51 51
     );
52 52
 });
53 53
 
54
-$api->get('/teams', function ($request, $response, $args) {
54
+$api->get('/teams', function($request, $response, $args) {
55 55
     return Responder::getJsonResponse(
56 56
         Team::all(),
57 57
         $response
58 58
     );
59 59
 });
60 60
 
61
-$api->get('/teams/{id}', function ($request, $response, $args) {
61
+$api->get('/teams/{id}', function($request, $response, $args) {
62 62
     return Responder::getJsonResponse(
63 63
         Team::complete()
64 64
             ->where(
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
     );
71 71
 });
72 72
 
73
-$api->get('/teams/{id}/players', function ($request, $response, $args) {
73
+$api->get('/teams/{id}/players', function($request, $response, $args) {
74 74
     return Responder::getJsonResponse(
75 75
         Team::with(
76 76
             'roster'
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
     );
84 84
 });
85 85
 
86
-$api->get('/teams/{id}/players/{playerId}', function ($request, $response, $args) {
86
+$api->get('/teams/{id}/players/{playerId}', function($request, $response, $args) {
87 87
     return Responder::getJsonResponse(
88 88
         Player::statistics()->where(
89 89
             [
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
     );
96 96
 });
97 97
 
98
-$api->get('/teams/{id}/coach', function ($request, $response, $args) {
98
+$api->get('/teams/{id}/coach', function($request, $response, $args) {
99 99
     return Responder::getJsonResponse(
100 100
         Team::with(
101 101
             'coach'
@@ -108,14 +108,14 @@  discard block
 block discarded – undo
108 108
     );
109 109
 });
110 110
 
111
-$api->get('/leagues', function ($request, $response, $args) {
111
+$api->get('/leagues', function($request, $response, $args) {
112 112
     return Responder::getJsonResponse(
113 113
         League::all(),
114 114
         $response
115 115
     );
116 116
 });
117 117
 
118
-$api->get('/leagues/{id}', function ($request, $response, $args) {
118
+$api->get('/leagues/{id}', function($request, $response, $args) {
119 119
     return Responder::getJsonResponse(
120 120
         League::with('rounds')
121 121
             ->where(
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
         $response
127 127
     );
128 128
 });
129
-$api->get('/leagues/{id}/rounds/{roundId}/matches', function ($request, $response, $args) {
129
+$api->get('/leagues/{id}/rounds/{roundId}/matches', function($request, $response, $args) {
130 130
     return Responder::getJsonResponse(
131 131
         Match::teams()
132 132
             ->where(
@@ -137,14 +137,14 @@  discard block
 block discarded – undo
137 137
         $response
138 138
     );
139 139
 });
140
-$api->get('/matches', function ($request, $response, $args) {
140
+$api->get('/matches', function($request, $response, $args) {
141 141
     return Responder::getJsonResponse(
142 142
         Match::teams()->get(),
143 143
         $response
144 144
     );
145 145
 });
146 146
 
147
-$api->post('/matches', function ($request, $response, $args) {
147
+$api->post('/matches', function($request, $response, $args) {
148 148
     $json = $request->getBody();
149 149
     $json = json_decode($json, true);
150 150
     return Responder::getJsonResponse(
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
     );
156 156
 });
157 157
 
158
-$api->get('/matches/{id}', function ($request, $response, $args) {
158
+$api->get('/matches/{id}', function($request, $response, $args) {
159 159
     return Responder::getJsonResponse(
160 160
         Match::complete()
161 161
             ->where(
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
     );
168 168
 });
169 169
 
170
-$api->get('/matches/{id}/result', function ($request, $response, $args) {
170
+$api->get('/matches/{id}/result', function($request, $response, $args) {
171 171
     $result = MatchResult::complete()
172 172
         ->where(
173 173
             [
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
     );
182 182
 });
183 183
 
184
-$api->put('/matches/{id}/simulate', function ($request, $response, $args) {
184
+$api->put('/matches/{id}/simulate', function($request, $response, $args) {
185 185
     return Responder::getJsonResponse(
186 186
         MatchSimulator::simulate(
187 187
             $args['id']
Please login to merge, or discard this patch.
api/tests/HelpersTest.php 1 patch
Indentation   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -8,71 +8,71 @@
 block discarded – undo
8 8
 {
9 9
 
10 10
 
11
-    /**
12
-     * @group Helpers
13
-     * @group FixtureGenerator
14
-     * @group generatefixture
15
-     */
16
-    public function testFixtureGenerator()
17
-    {
18
-        $teams = \App\Lib\DsManager\Models\Orm\Team::all();
19
-        $rounds = \App\Lib\DsManager\Helpers\LeagueFixtureGenerator::generate(
20
-            $teams->toArray()
21
-        );
22
-        //Number of rounds
23
-        $this->assertCount($teams->count() - 1, $rounds);
24
-        //Matches for each round
25
-        foreach ($rounds as $round) {
26
-            $this->assertCount($teams->count() / 2, $round);
27
-        }
28
-    }
11
+	/**
12
+	 * @group Helpers
13
+	 * @group FixtureGenerator
14
+	 * @group generatefixture
15
+	 */
16
+	public function testFixtureGenerator()
17
+	{
18
+		$teams = \App\Lib\DsManager\Models\Orm\Team::all();
19
+		$rounds = \App\Lib\DsManager\Helpers\LeagueFixtureGenerator::generate(
20
+			$teams->toArray()
21
+		);
22
+		//Number of rounds
23
+		$this->assertCount($teams->count() - 1, $rounds);
24
+		//Matches for each round
25
+		foreach ($rounds as $round) {
26
+			$this->assertCount($teams->count() / 2, $round);
27
+		}
28
+	}
29 29
 
30
-    /**
31
-     * @group Helpers
32
-     * @group MatchSimulator
33
-     */
34
-    public function testMatchSimulator()
35
-    {
36
-        $match = \App\Lib\DsManager\Models\Orm\Match::where(
37
-            [
38
-                'simulated' => false
39
-            ]
40
-        )->get()->random(1);
41
-        $this->assertNotEmpty($match);
42
-        $result = \App\Lib\DsManager\Helpers\MatchSimulator::simulate($match->id);
43
-        $this->assertNotEmpty($result);
44
-        $match = \App\Lib\DsManager\Models\Orm\Match::where(
45
-            [
46
-                'id' => $match->id,
47
-                'simulated' => true
48
-            ]
49
-        )->first();
50
-        $this->assertNotEmpty($match);
51
-    }
30
+	/**
31
+	 * @group Helpers
32
+	 * @group MatchSimulator
33
+	 */
34
+	public function testMatchSimulator()
35
+	{
36
+		$match = \App\Lib\DsManager\Models\Orm\Match::where(
37
+			[
38
+				'simulated' => false
39
+			]
40
+		)->get()->random(1);
41
+		$this->assertNotEmpty($match);
42
+		$result = \App\Lib\DsManager\Helpers\MatchSimulator::simulate($match->id);
43
+		$this->assertNotEmpty($result);
44
+		$match = \App\Lib\DsManager\Models\Orm\Match::where(
45
+			[
46
+				'id' => $match->id,
47
+				'simulated' => true
48
+			]
49
+		)->first();
50
+		$this->assertNotEmpty($match);
51
+	}
52 52
 
53
-    /**
54
-     * @group Helpers
55
-     * @group RoundSimulator
56
-     */
57
-    public function testRoundSimulator()
58
-    {
59
-        $match = \App\Lib\DsManager\Models\Orm\Match::where(
60
-            [
61
-                'simulated' => false
62
-            ]
63
-        )->whereNotNull(
64
-            'league_round_id'
65
-        )->get()->random(1);
66
-        $this->assertNotEmpty($match);
67
-        $result = \App\Lib\DsManager\Helpers\MatchSimulator::simulateRound($match->league_round_id);
68
-        $this->assertNotEmpty($result);
69
-        $match = \App\Lib\DsManager\Models\Orm\Match::where(
70
-            [
71
-                'id' => $match->id,
72
-                'simulated' => true
73
-            ]
74
-        )->first();
75
-        $this->assertNotEmpty($match);
76
-    }
53
+	/**
54
+	 * @group Helpers
55
+	 * @group RoundSimulator
56
+	 */
57
+	public function testRoundSimulator()
58
+	{
59
+		$match = \App\Lib\DsManager\Models\Orm\Match::where(
60
+			[
61
+				'simulated' => false
62
+			]
63
+		)->whereNotNull(
64
+			'league_round_id'
65
+		)->get()->random(1);
66
+		$this->assertNotEmpty($match);
67
+		$result = \App\Lib\DsManager\Helpers\MatchSimulator::simulateRound($match->league_round_id);
68
+		$this->assertNotEmpty($result);
69
+		$match = \App\Lib\DsManager\Models\Orm\Match::where(
70
+			[
71
+				'id' => $match->id,
72
+				'simulated' => true
73
+			]
74
+		)->first();
75
+		$this->assertNotEmpty($match);
76
+	}
77 77
 
78 78
 }
Please login to merge, or discard this patch.
api/database/seeds/A001LeaguesSeeder.php 1 patch
Indentation   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -9,46 +9,46 @@
 block discarded – undo
9 9
 
10 10
 class A001LeaguesSeeder
11 11
 {
12
-    function run()
13
-    {
14
-        $leagues = [
15
-            'friendly' => 16,
16
-            'europa league' => 8
17
-        ];
18
-        $teams = Team::all()->toArray();
19
-        foreach ($leagues as $league => $teamsNum) {
12
+	function run()
13
+	{
14
+		$leagues = [
15
+			'friendly' => 16,
16
+			'europa league' => 8
17
+		];
18
+		$teams = Team::all()->toArray();
19
+		foreach ($leagues as $league => $teamsNum) {
20 20
 
21
-            $teamCopy = $teams;
22
-            $league = League::create(
23
-                [
24
-                    'name' => $league,
25
-                    'teams' => $teamsNum
26
-                ]
27
-            );
21
+			$teamCopy = $teams;
22
+			$league = League::create(
23
+				[
24
+					'name' => $league,
25
+					'teams' => $teamsNum
26
+				]
27
+			);
28 28
 
29
-            //Create Rounds
30
-            shuffle($teamCopy);
31
-            $teamCopy = array_splice($teamCopy, 0, $teamsNum);
32
-            $rounds = LeagueFixtureGenerator::generate($teamCopy);
33
-            foreach ($rounds as $i => $round) {
29
+			//Create Rounds
30
+			shuffle($teamCopy);
31
+			$teamCopy = array_splice($teamCopy, 0, $teamsNum);
32
+			$rounds = LeagueFixtureGenerator::generate($teamCopy);
33
+			foreach ($rounds as $i => $round) {
34 34
 
35
-                $leagueRound = LeagueRound::create(
36
-                    [
37
-                        'league_id' => $league->id,
38
-                        'day' => $i + 1
39
-                    ]
40
-                );
35
+				$leagueRound = LeagueRound::create(
36
+					[
37
+						'league_id' => $league->id,
38
+						'day' => $i + 1
39
+					]
40
+				);
41 41
 
42
-                foreach ($round as $match) {
43
-                    $newMatch = Match::create(
44
-                        [
45
-                            'home_team_id' => $match['home_team_id'],
46
-                            'away_team_id' => $match['away_team_id'],
47
-                            'league_round_id' => $leagueRound->id
48
-                        ]
49
-                    );
50
-                }
51
-            }
52
-        }
53
-    }
42
+				foreach ($round as $match) {
43
+					$newMatch = Match::create(
44
+						[
45
+							'home_team_id' => $match['home_team_id'],
46
+							'away_team_id' => $match['away_team_id'],
47
+							'league_round_id' => $leagueRound->id
48
+						]
49
+					);
50
+				}
51
+			}
52
+		}
53
+	}
54 54
 }
55 55
\ No newline at end of file
Please login to merge, or discard this patch.
api/database/migrations/CreateLeagueRoundsTable.php 2 patches
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -5,19 +5,19 @@
 block discarded – undo
5 5
 
6 6
 class CreateLeagueRoundsTable
7 7
 {
8
-    /**
9
-     * Run the migrations.
10
-     *
11
-     * @return void
12
-     */
13
-    public function run()
14
-    {
15
-        Capsule::schema()->dropIfExists('league_rounds');
16
-        Capsule::schema()->create('league_rounds', function (Blueprint $table) {
17
-            $table->increments('id');
18
-            $table->integer('league_id');
19
-            $table->integer('day')->default(0);
20
-            $table->timestamps();
21
-        });
22
-    }
8
+	/**
9
+	 * Run the migrations.
10
+	 *
11
+	 * @return void
12
+	 */
13
+	public function run()
14
+	{
15
+		Capsule::schema()->dropIfExists('league_rounds');
16
+		Capsule::schema()->create('league_rounds', function (Blueprint $table) {
17
+			$table->increments('id');
18
+			$table->integer('league_id');
19
+			$table->integer('day')->default(0);
20
+			$table->timestamps();
21
+		});
22
+	}
23 23
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
     public function run()
14 14
     {
15 15
         Capsule::schema()->dropIfExists('league_rounds');
16
-        Capsule::schema()->create('league_rounds', function (Blueprint $table) {
16
+        Capsule::schema()->create('league_rounds', function(Blueprint $table) {
17 17
             $table->increments('id');
18 18
             $table->integer('league_id');
19 19
             $table->integer('day')->default(0);
Please login to merge, or discard this patch.
api/Lib/DsManager/Models/Orm/League.php 1 patch
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -8,24 +8,24 @@
 block discarded – undo
8 8
  */
9 9
 class League extends DsManagerOrm
10 10
 {
11
-    /**
12
-     * @var string
13
-     */
14
-    protected $table = 'leagues';
11
+	/**
12
+	 * @var string
13
+	 */
14
+	protected $table = 'leagues';
15 15
 
16
-    /**
17
-     * @var array
18
-     */
19
-    protected $fillable = [
20
-        'name',
21
-        'teams'
22
-    ];
16
+	/**
17
+	 * @var array
18
+	 */
19
+	protected $fillable = [
20
+		'name',
21
+		'teams'
22
+	];
23 23
 
24
-    /**
25
-     * @return \Illuminate\Database\Eloquent\Relations\HasMany
26
-     */
27
-    public function rounds()
28
-    {
29
-        return $this->hasMany(LeagueRound::class);
30
-    }
24
+	/**
25
+	 * @return \Illuminate\Database\Eloquent\Relations\HasMany
26
+	 */
27
+	public function rounds()
28
+	{
29
+		return $this->hasMany(LeagueRound::class);
30
+	}
31 31
 } 
32 32
\ No newline at end of file
Please login to merge, or discard this patch.
api/Lib/DsManager/Models/Orm/LeagueRound.php 1 patch
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -9,32 +9,32 @@
 block discarded – undo
9 9
 class LeagueRound extends DsManagerOrm
10 10
 {
11 11
 
12
-    /**
13
-     * @var string
14
-     */
15
-    protected $table = 'league_rounds';
12
+	/**
13
+	 * @var string
14
+	 */
15
+	protected $table = 'league_rounds';
16 16
 
17
-    /**
18
-     * @var array
19
-     */
20
-    protected $fillable = [
21
-        'league_id',
22
-        'day'
23
-    ];
17
+	/**
18
+	 * @var array
19
+	 */
20
+	protected $fillable = [
21
+		'league_id',
22
+		'day'
23
+	];
24 24
 
25
-    /**
26
-     * @return \Illuminate\Database\Eloquent\Relations\HasOne
27
-     */
28
-    public function league()
29
-    {
30
-        return $this->hasOne(League::class);
31
-    }
25
+	/**
26
+	 * @return \Illuminate\Database\Eloquent\Relations\HasOne
27
+	 */
28
+	public function league()
29
+	{
30
+		return $this->hasOne(League::class);
31
+	}
32 32
 
33
-    /**
34
-     * @return \Illuminate\Database\Eloquent\Relations\HasMany
35
-     */
36
-    public function matches()
37
-    {
38
-        return $this->hasMany(Match::class);
39
-    }
33
+	/**
34
+	 * @return \Illuminate\Database\Eloquent\Relations\HasMany
35
+	 */
36
+	public function matches()
37
+	{
38
+		return $this->hasMany(Match::class);
39
+	}
40 40
 }
41 41
\ No newline at end of file
Please login to merge, or discard this patch.