Completed
Push — master ( c60305...7f3e18 )
by Vincenzo
02:47
created
api/index.php 1 patch
Spacing   +18 added lines, -18 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(
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
     );
128 128
 });
129 129
 
130
-$api->get('/leagues/{id}/rounds/{roundId}/matches', function ($request, $response, $args) {
130
+$api->get('/leagues/{id}/rounds/{roundId}/matches', function($request, $response, $args) {
131 131
     return Responder::getJsonResponse(
132 132
         Match::teams()
133 133
             ->where(
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
     );
140 140
 });
141 141
 
142
-$api->put('/leagues/{id}/rounds/{roundId}/simulate', function ($request, $response, $args) {
142
+$api->put('/leagues/{id}/rounds/{roundId}/simulate', function($request, $response, $args) {
143 143
     return Responder::getJsonResponse(
144 144
         MatchSimulator::simulateRound(
145 145
             $args['roundId']
@@ -148,14 +148,14 @@  discard block
 block discarded – undo
148 148
     );
149 149
 });
150 150
 
151
-$api->get('/matches', function ($request, $response, $args) {
151
+$api->get('/matches', function($request, $response, $args) {
152 152
     return Responder::getJsonResponse(
153 153
         Match::teams()->get(),
154 154
         $response
155 155
     );
156 156
 });
157 157
 
158
-$api->post('/matches', function ($request, $response, $args) {
158
+$api->post('/matches', function($request, $response, $args) {
159 159
     $json = $request->getBody();
160 160
     $json = json_decode($json, true);
161 161
     return Responder::getJsonResponse(
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
     );
167 167
 });
168 168
 
169
-$api->get('/matches/{id}', function ($request, $response, $args) {
169
+$api->get('/matches/{id}', function($request, $response, $args) {
170 170
     return Responder::getJsonResponse(
171 171
         Match::complete()
172 172
             ->where(
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
     );
179 179
 });
180 180
 
181
-$api->get('/matches/{id}/result', function ($request, $response, $args) {
181
+$api->get('/matches/{id}/result', function($request, $response, $args) {
182 182
     $result = MatchResult::complete()
183 183
         ->where(
184 184
             [
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
     );
193 193
 });
194 194
 
195
-$api->put('/matches/{id}/simulate', function ($request, $response, $args) {
195
+$api->put('/matches/{id}/simulate', function($request, $response, $args) {
196 196
     return Responder::getJsonResponse(
197 197
         MatchSimulator::simulateCompleteResult(
198 198
             $args['id']
Please login to merge, or discard this patch.