1
|
|
|
<?php |
2
|
|
|
namespace PhpDraft\Domain\Repositories; |
3
|
|
|
|
4
|
|
|
use Silex\Application; |
5
|
|
|
use PhpDraft\Domain\Entities\Trade; |
6
|
|
|
use PhpDraft\Domain\Entities\TradeAsset; |
7
|
|
|
|
8
|
|
|
class DraftDataRepository { |
9
|
|
|
private $app; |
10
|
|
|
|
11
|
|
|
private $colors; |
12
|
|
|
private $position_colors; |
13
|
|
|
private $sports; |
14
|
|
|
private $styles; |
15
|
|
|
private $statuses; |
16
|
|
|
|
17
|
|
|
private $mlb_teams; |
18
|
|
|
private $historical_mlb_teams; |
19
|
|
|
private $nba_teams; |
20
|
|
|
private $historical_nba_teams; |
21
|
|
|
private $nfl_teams; |
22
|
|
|
private $historical_nfl_teams; |
23
|
|
|
private $nhl_teams; |
24
|
|
|
private $historical_nhl_teams; |
25
|
|
|
private $super_rugby_teams; |
26
|
|
|
private $historical_super_rugby_teams; |
27
|
|
|
|
28
|
|
|
private $mlb_positions; |
29
|
|
|
private $nba_positions; |
30
|
|
|
private $nfl_positions; |
31
|
|
|
private $nhl_positions; |
32
|
|
|
private $extended_nfl_positions; |
33
|
|
|
private $super_rugby_positions; |
34
|
|
|
|
35
|
|
|
public function __construct(Application $app) { |
36
|
|
|
$this->app = $app; |
37
|
|
|
|
38
|
|
|
$this->colors = array( |
39
|
|
|
"light_orange" => "#FFCC66", |
40
|
|
|
"light_blue" => "#CCFFFF", |
41
|
|
|
"light_yellow" => "#FFFF99", |
42
|
|
|
"light_red" => "#FF9999", |
43
|
|
|
"dark_green" => "#99CC99", |
44
|
|
|
"light_purple" => "#CCCCFF", |
45
|
|
|
"light_green" => "#CCFFCC", |
46
|
|
|
"light_pink" => "#FFCCFF", |
47
|
|
|
"seafoam" => "#99CCCC", |
48
|
|
|
"switchgrass" => "#DAFF7F", |
49
|
|
|
"gray" => "#99CCCC" |
50
|
|
|
); |
51
|
|
|
|
52
|
|
|
$this->position_colors = array( |
53
|
|
|
//Hockey/NHL |
54
|
|
|
"LW" => $this->colors['light_orange'], //LT ORANGE * |
55
|
|
|
"C" => $this->colors['light_blue'], //LT BLUE * |
56
|
|
|
"RW" => $this->colors['light_yellow'], //LT YELLOW * |
57
|
|
|
"D" => $this->colors['light_red'], //LT RED * |
58
|
|
|
"G" => $this->colors['dark_green'], //DK GREEN * |
59
|
|
|
//Football/NFL |
60
|
|
|
"QB" => $this->colors['light_blue'], //LT BLUE |
61
|
|
|
"RB" => $this->colors['light_orange'], //LT ORANGE |
62
|
|
|
"WR" => $this->colors['light_yellow'], //LT YELLOW |
63
|
|
|
"TE" => $this->colors['light_red'], //LT RED |
64
|
|
|
"DEF" => $this->colors['dark_green'], //DK GREEN |
65
|
|
|
"K" => $this->colors['light_purple'], //LT PURPLE * |
66
|
|
|
"DL" => $this->colors['light_green'], |
67
|
|
|
"LB" => $this->colors['light_pink'], |
68
|
|
|
"DB" => $this->colors['seafoam'], |
69
|
|
|
"OL" => $this->colors['switchgrass'], |
70
|
|
|
//Baseball/MLB |
71
|
|
|
//CATCHER ALREADY DONE: LT BLUE |
72
|
|
|
"1B" => $this->colors['light_orange'], //LT ORANGE |
73
|
|
|
"2B" => $this->colors['light_yellow'], //LT YELLOW |
74
|
|
|
"3B" => $this->colors['light_red'], //LT RED |
75
|
|
|
"SS" => $this->colors['dark_green'], //DK GREEN |
76
|
|
|
"OF" => $this->colors['light_green'], //LT GREEN * |
77
|
|
|
"UTIL" => $this->colors['light_pink'], //LT PINK * |
78
|
|
|
"SP" => $this->colors['light_purple'], //LT PURPLE |
79
|
|
|
"RP" => $this->colors['seafoam'], //SEAFOAM * |
80
|
|
|
//Basketball/NBA |
81
|
|
|
"PG" => $this->colors['light_orange'], //LT ORANGE |
82
|
|
|
"SG" => $this->colors['dark_green'], //DK GREEN |
83
|
|
|
"SF" => $this->colors['light_yellow'], //LT YELLOW |
84
|
|
|
"PF" => $this->colors['light_red'], //LT RED |
85
|
|
|
//CENTER ALREADY DONE: LT BLUE |
86
|
|
|
//Rugby/Super Rugby |
87
|
|
|
"FR" => $this->colors['light_orange'], |
88
|
|
|
"HB" => $this->colors['light_yellow'], |
89
|
|
|
"LF" => $this->colors['light_red'], |
90
|
|
|
"OB" => $this->colors['dark_green'], |
91
|
|
|
"M" => $this->colors['light_green'], |
92
|
|
|
"L" => $this->colors['light_pink'], |
93
|
|
|
"FH" => $this->colors['light_purple'] |
94
|
|
|
); |
95
|
|
|
|
96
|
|
|
$this->sports = array( |
97
|
|
|
"NFL" => "Football (NFL)", |
98
|
|
|
"NFLE" => "Football - Extended Rosters (NFL)", |
99
|
|
|
"MLB" => "Baseball (MLB)", |
100
|
|
|
"NBA" => "Basketball (NBA)", |
101
|
|
|
"NHL" => "Hockey (NHL)", |
102
|
|
|
"S15" => "Rugby (Super 15)" |
103
|
|
|
); |
104
|
|
|
|
105
|
|
|
$this->styles = array( |
106
|
|
|
"serpentine" => "Serpentine Draft", |
107
|
|
|
"standard" => "Standard Draft" |
108
|
|
|
); |
109
|
|
|
|
110
|
|
|
$this->statuses = array( |
111
|
|
|
"undrafted" => "Setting Up", |
112
|
|
|
"in_progress" => "In Progress", |
113
|
|
|
"complete" => "Completed" |
114
|
|
|
); |
115
|
|
|
|
116
|
|
|
//PHPD-70: FIX 3 INFIELD ISSUES WITH CSS CLASS NAMES: |
117
|
|
|
$this->position_colors = array_merge($this->position_colors, array( |
118
|
|
|
"x1B" => $this->position_colors['1B'], |
119
|
|
|
"x2B" => $this->position_colors['2B'], |
120
|
|
|
"x3B" => $this->position_colors['3B'], |
121
|
|
|
)); |
122
|
|
|
|
123
|
|
|
$this->nhl_teams = array( |
124
|
|
|
"ANA" => "Anaheim Ducks", |
125
|
|
|
"BOS" => "Boston Bruins", |
126
|
|
|
"BUF" => "Buffalo Sabres", |
127
|
|
|
"CGY" => "Calgary Flames", |
128
|
|
|
"CAR" => "Carolina Hurricanes", |
129
|
|
|
"CHI" => "Chicago Blackhawks", |
130
|
|
|
"COL" => "Colorado Avalanche", |
131
|
|
|
"CBS" => "Columbus Blue Jackets", |
132
|
|
|
"DAL" => "Dallas Stars", |
133
|
|
|
"DET" => "Detroit Red Wings", |
134
|
|
|
"EDM" => "Edmonton Oilers", |
135
|
|
|
"FLA" => "Florida Panthers", |
136
|
|
|
"LAK" => "Los Angeles Kings", |
137
|
|
|
"MIN" => "Minnesota Wild", |
138
|
|
|
"MTL" => "Montreal Canadiens", |
139
|
|
|
"NSH" => "Nashville Predators", |
140
|
|
|
"NJD" => "New Jersey Devils", |
141
|
|
|
"NYI" => "New York Islanders", |
142
|
|
|
"NYR" => "New York Rangers", |
143
|
|
|
"OTT" => "Ottawa Senators", |
144
|
|
|
"PHI" => "Philadelphia Flyers", |
145
|
|
|
"ARI" => "Arizona Coyotes", |
146
|
|
|
"PIT" => "Pittsburgh Penguins", |
147
|
|
|
"SJS" => "San Jose Sharks", |
148
|
|
|
"STL" => "St Louis Blues", |
149
|
|
|
"TAM" => "Tampa Bay Lightning", |
150
|
|
|
"TOR" => "Toronto Maple Leafs", |
151
|
|
|
"VAN" => "Vancouver Canucks", |
152
|
|
|
"VGK" => "Vegas Golden Knights", |
153
|
|
|
"WAS" => "Washington Capitals", |
154
|
|
|
"WPG" => "Winnipeg Jets" |
155
|
|
|
); |
156
|
|
|
|
157
|
|
|
$this->historical_nhl_teams = array_merge($this->mlb_teams, array( |
158
|
|
|
|
159
|
|
|
)); |
160
|
|
|
|
161
|
|
|
$this->nhl_positions = array( |
162
|
|
|
"LW" => "Left Wing", |
163
|
|
|
"RW" => "Right Wing", |
164
|
|
|
"C" => "Center", |
165
|
|
|
"D" => "Defenseman", |
166
|
|
|
"G" => "Goaltender" |
167
|
|
|
); |
168
|
|
|
|
169
|
|
|
$this->nfl_teams = array( |
170
|
|
|
"ARI" => "Arizona Cardinals", |
171
|
|
|
"ATL" => "Atlanta Falcons", |
172
|
|
|
"BAL" => "Baltimore Ravens", |
173
|
|
|
"BUF" => "Buffalo Bills", |
174
|
|
|
"CAR" => "Carolina Panthers", |
175
|
|
|
"CHI" => "Chicago Bears", |
176
|
|
|
"CIN" => "Cincinnati Bengals", |
177
|
|
|
"CLE" => "Cleveland Browns", |
178
|
|
|
"DAL" => "Dallas Cowboys", |
179
|
|
|
"DEN" => "Denver Broncos", |
180
|
|
|
"DET" => "Detroit Lions", |
181
|
|
|
"GNB" => "Green Bay Packers", |
182
|
|
|
"HOU" => "Houston Texans", |
183
|
|
|
"IND" => "Indianapolis Colts", |
184
|
|
|
"JAC" => "Jacksonville Jaguars", |
185
|
|
|
"K.C" => "Kansas City Chiefs", |
186
|
|
|
"LAC" => "Los Angeles Chargers", |
187
|
|
|
"LAR" => "Los Angeles Rams", |
188
|
|
|
"MIA" => "Miami Dolphins", |
189
|
|
|
"MIN" => "Minnesota Vikings", |
190
|
|
|
"NWE" => "New England Patriots", |
191
|
|
|
"NOR" => "New Orleans Saints", |
192
|
|
|
"NYG" => "New York Giants", |
193
|
|
|
"NYJ" => "New York Jets", |
194
|
|
|
"OAK" => "Oakland Raiders", |
195
|
|
|
"PHI" => "Philadelphia Eagles", |
196
|
|
|
"PIT" => "Pittsburgh Steelers", |
197
|
|
|
"SFO" => "San Francisco 49ers", |
198
|
|
|
"SEA" => "Seattle Seahawks", |
199
|
|
|
"TAM" => "Tampa Bay Buccaneers", |
200
|
|
|
"TEN" => "Tennessee Titans", |
201
|
|
|
"WAS" => "Washington Redskins" |
202
|
|
|
); |
203
|
|
|
|
204
|
|
|
$this->historical_nfl_teams = array_merge($this->nfl_teams, array( |
205
|
|
|
"STL" => "St. Louis Rams", |
206
|
|
|
"SDG" => "San Diego Chargers" |
207
|
|
|
)); |
208
|
|
|
|
209
|
|
|
$this->nfl_positions = array( |
210
|
|
|
"QB" => "Quarterback", |
211
|
|
|
"RB" => "Runningback", |
212
|
|
|
"WR" => "Wide Receiver", |
213
|
|
|
"TE" => "Tight End", |
214
|
|
|
"DEF" => "Defense", |
215
|
|
|
"K" => "Kicker" |
216
|
|
|
); |
217
|
|
|
|
218
|
|
|
$this->extended_nfl_positions = array_merge($this->nfl_positions, array( |
219
|
|
|
"DL" => "Defensive Lineman", |
220
|
|
|
"LB" => "Linebacker", |
221
|
|
|
"DB" => "Defensive Back", |
222
|
|
|
"OL" => "Offensive Lineman" |
223
|
|
|
)); |
224
|
|
|
|
225
|
|
|
$this->mlb_teams = array( |
226
|
|
|
"ARI" => "Arizona Diamondbacks", |
227
|
|
|
"ATL" => "Atlanta Braves", |
228
|
|
|
"BAL" => "Baltimore Orioles", |
229
|
|
|
"BOS" => "Boston Red Sox", |
230
|
|
|
"CHC" => "Chicago Cubs", |
231
|
|
|
"CWS" => "Chicago White Sox", |
232
|
|
|
"CIN" => "Cincinnati Reds", |
233
|
|
|
"CLE" => "Cleveland Indians", |
234
|
|
|
"COL" => "Colorado Rockies", |
235
|
|
|
"DET" => "Detroit Tigers", |
236
|
|
|
"HOU" => "Houston Astros", |
237
|
|
|
"K.C" => "Kansas City Royals", |
238
|
|
|
"LAA" => "Los Angeles Angels", |
239
|
|
|
"LAD" => "Los Angeles Dodgers", |
240
|
|
|
"MIA" => "Miami Marlins", |
241
|
|
|
"MIL" => "Milwaukee Brewers", |
242
|
|
|
"MIN" => "Minnesota Twins", |
243
|
|
|
"NYM" => "New York Mets", |
244
|
|
|
"NYY" => "New York Yankees", |
245
|
|
|
"OAK" => "Oakland Athletics", |
246
|
|
|
"PHI" => "Philadelphia Phillies", |
247
|
|
|
"PIT" => "Pittsburgh Pirates", |
248
|
|
|
"SDG" => "San Diego Padres", |
249
|
|
|
"SFO" => "San Francisco Giants", |
250
|
|
|
"SEA" => "Seattle Mariners", |
251
|
|
|
"STL" => "St Louis Cardinals", |
252
|
|
|
"TAM" => "Tampa Bay Rays", |
253
|
|
|
"TEX" => "Texas Rangers", |
254
|
|
|
"TOR" => "Toronto Blue Jays", |
255
|
|
|
"WAS" => "Washington Nationals" |
256
|
|
|
); |
257
|
|
|
|
258
|
|
|
$this->historical_mlb_teams = array_merge($this->mlb_teams, array( |
259
|
|
|
|
260
|
|
|
)); |
261
|
|
|
|
262
|
|
|
$this->mlb_positions = array( |
263
|
|
|
"C" => "Catcher", |
264
|
|
|
"1B" => "1st Base", |
265
|
|
|
"2B" => "2nd Base", |
266
|
|
|
"3B" => "3rd Base", |
267
|
|
|
"SS" => "Shortstop", |
268
|
|
|
"OF" => "Outfielder", |
269
|
|
|
"UTIL" => "Utility", |
270
|
|
|
"SP" => "Starting Pitcher", |
271
|
|
|
"RP" => "Relief Pitcher" |
272
|
|
|
); |
273
|
|
|
|
274
|
|
|
$this->nba_teams = array( |
275
|
|
|
"ATL" => "Atlanta Hawks", |
276
|
|
|
"BKN" => "Brooklyn Nets", |
277
|
|
|
"BOS" => "Boston Celtics", |
278
|
|
|
"CHI" => "Chicago Bulls", |
279
|
|
|
"CHA" => "Charlotte Hornets", |
280
|
|
|
"CLE" => "Cleveland Cavaliers", |
281
|
|
|
"DAL" => "Dallas Mavericks", |
282
|
|
|
"DEN" => "Denver Nuggets", |
283
|
|
|
"DET" => "Detroit Pistons", |
284
|
|
|
"GSW" => "Golden State Warriors", |
285
|
|
|
"HOU" => "Houston Rockets", |
286
|
|
|
"IND" => "Indiana Pacers", |
287
|
|
|
"LAC" => "Los Angeles Clippers", |
288
|
|
|
"LAL" => "Los Angeles Lakers", |
289
|
|
|
"MIL" => "Milwaukee Bucks", |
290
|
|
|
"NYK" => "New York Knicks", |
291
|
|
|
"PHI" => "Philadelphia 76ers", |
292
|
|
|
"PHO" => "Phoenix Suns", |
293
|
|
|
"POR" => "Portland Trail Blazers", |
294
|
|
|
"SAC" => "Sacramento Kings", |
295
|
|
|
"SAS" => "San Antonio Spurs", |
296
|
|
|
"OKC" => "Oklahoma City Thunder", |
297
|
|
|
"UTH" => "Utah Jazz", |
298
|
|
|
"WAS" => "Washington Wizards", |
299
|
|
|
"NOR" => "New Orleans Pelicans", |
300
|
|
|
"MIA" => "Miami Heat", |
301
|
|
|
"MIN" => "Minnesota Timberwolves", |
302
|
|
|
"ORL" => "Orlando Magic", |
303
|
|
|
"TOR" => "Toronto Raptors", |
304
|
|
|
"MEM" => "Memphis Grizzlies" |
305
|
|
|
); |
306
|
|
|
|
307
|
|
|
$this->historical_nba_teams = array_merge($this->nba_teams, array( |
308
|
|
|
|
309
|
|
|
)); |
310
|
|
|
|
311
|
|
|
$this->nba_positions = array( |
312
|
|
|
"PG" => "Point Guard", |
313
|
|
|
"SG" => "Shooting Guard", |
314
|
|
|
"SF" => "Small Forward", |
315
|
|
|
"PF" => "Power Forward", |
316
|
|
|
"C" => "Center" |
317
|
|
|
); |
318
|
|
|
|
319
|
|
|
$this->super_rugby_positions = array( |
320
|
|
|
"FH" => "Fly Half", |
321
|
|
|
"OB" => "Outside Back", |
322
|
|
|
"M" => "Midfielder", |
323
|
|
|
"LF" => "Loose Forward", |
324
|
|
|
"HB" => "Half Back", |
325
|
|
|
"L" => "Lock", |
326
|
|
|
"FR" => "Front Row" |
327
|
|
|
); |
328
|
|
|
|
329
|
|
|
$this->super_rugby_teams = array( |
330
|
|
|
"BLU" => "Blues", |
331
|
|
|
"BRU" => "Brumbies", |
332
|
|
|
"BUL" => "Bulls", |
333
|
|
|
"CHE" => "Cheetahs", |
334
|
|
|
"CHI" => "Chiefs", |
335
|
|
|
"CRU" => "Crusaders", |
336
|
|
|
"FOR" => "Force", |
337
|
|
|
"HIG" => "Highlanders", |
338
|
|
|
"HUR" => "Hurricanes", |
339
|
|
|
"JAG" => "Jaguars", |
340
|
|
|
"KIN" => "Kings", |
341
|
|
|
"LIO" => "Lions", |
342
|
|
|
"REB" => "Rebels", |
343
|
|
|
"RED" => "Reds", |
344
|
|
|
"SHA" => "Sharks", |
345
|
|
|
"STO" => "Stormers", |
346
|
|
|
"SUN" => "Sunwolves", |
347
|
|
|
"WAR" => "Waratahs" |
348
|
|
|
); |
349
|
|
|
|
350
|
|
|
$this->historical_super_rugby_teams = array_merge($this->super_rugby_teams, array( |
351
|
|
|
|
352
|
|
|
)); |
353
|
|
|
} |
354
|
|
|
|
355
|
|
|
public function GetPositionColors() { |
356
|
|
|
return $this->position_colors; |
357
|
|
|
} |
358
|
|
|
|
359
|
|
|
public function GetSports() { |
360
|
|
|
return $this->sports; |
361
|
|
|
} |
362
|
|
|
|
363
|
|
|
public function GetStyles() { |
364
|
|
|
return $this->styles; |
365
|
|
|
} |
366
|
|
|
|
367
|
|
|
public function GetStatuses() { |
368
|
|
|
return $this->statuses; |
369
|
|
|
} |
370
|
|
|
|
371
|
|
|
public function GetTeams($pro_league) { |
372
|
|
|
switch (strtolower($pro_league)) { |
373
|
|
|
case 'nhl': |
374
|
|
|
case'hockey': |
375
|
|
|
return $this->nhl_teams; |
376
|
|
|
case 'nfl': |
377
|
|
|
case 'nfle': |
378
|
|
|
case 'football': |
379
|
|
|
return $this->nfl_teams; |
380
|
|
|
case 'mlb': |
381
|
|
|
case 'baseball': |
382
|
|
|
return $this->mlb_teams; |
383
|
|
|
case 'nba': |
384
|
|
|
case 'basketball': |
385
|
|
|
return $this->nba_teams; |
386
|
|
|
case 's15': |
387
|
|
|
return $this->super_rugby_teams; |
388
|
|
|
} |
389
|
|
|
} |
390
|
|
|
|
391
|
|
|
public function GetHistoricalTeams($pro_league) { |
392
|
|
|
switch (strtolower($pro_league)) { |
393
|
|
|
case 'nhl': |
394
|
|
|
case 'hockey': |
395
|
|
|
return $this->historical_nhl_teams; |
396
|
|
|
case 'nfl': |
397
|
|
|
case 'nfle': |
398
|
|
|
case 'football': |
399
|
|
|
return $this->historical_nfl_teams; |
400
|
|
|
case 'mlb': |
401
|
|
|
case 'baseball': |
402
|
|
|
return $this->historical_mlb_teams; |
403
|
|
|
case 'nba': |
404
|
|
|
case 'basketball': |
405
|
|
|
return $this->historical_nba_teams; |
406
|
|
|
case 's15': |
407
|
|
|
return $this->historical_super_rugby_teams; |
408
|
|
|
} |
409
|
|
|
} |
410
|
|
|
|
411
|
|
|
public function GetPositions($pro_league) { |
412
|
|
|
switch (strtolower($pro_league)) { |
413
|
|
|
case 'nhl': |
414
|
|
|
case 'hockey': |
415
|
|
|
return $this->nhl_positions; |
416
|
|
|
case 'nfl': |
417
|
|
|
case 'football': |
418
|
|
|
return $this->nfl_positions; |
419
|
|
|
case 'nfle': |
420
|
|
|
return $this->extended_nfl_positions; |
421
|
|
|
case 'mlb': |
422
|
|
|
case 'baseball': |
423
|
|
|
return $this->mlb_positions; |
424
|
|
|
case 'nba': |
425
|
|
|
case 'basketball': |
426
|
|
|
return $this->nba_positions; |
427
|
|
|
case 's15': |
428
|
|
|
return $this->super_rugby_positions; |
429
|
|
|
} |
430
|
|
|
} |
431
|
|
|
} |
432
|
|
|
|