|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* @file |
|
4
|
|
|
* Contains \TheSportsDb\Entity\Repository\EventRepository. |
|
5
|
|
|
*/ |
|
6
|
|
|
|
|
7
|
|
|
namespace TheSportsDb\Entity\Repository; |
|
8
|
|
|
|
|
9
|
|
|
/** |
|
10
|
|
|
* The default EventRepository implementation. |
|
11
|
|
|
* |
|
12
|
|
|
* @author Jelle Sebreghts |
|
13
|
|
|
*/ |
|
14
|
|
|
class EventRepository extends Repository implements EventRepositoryInterface { |
|
15
|
|
|
|
|
16
|
|
|
/** |
|
17
|
|
|
* {@inheritdoc} |
|
18
|
|
|
*/ |
|
19
|
|
|
protected $entityType = 'event'; |
|
20
|
|
|
|
|
21
|
|
|
/** |
|
22
|
|
|
* {@inheritdoc} |
|
23
|
|
|
*/ |
|
24
|
1 |
|
public function byName($name) { |
|
25
|
1 |
|
return $this->normalizeArray($this->sportsDbClient->doRequest('searchevents.php', array('e' => $name))->event); |
|
26
|
|
|
} |
|
27
|
|
|
|
|
28
|
|
|
/** |
|
29
|
|
|
* {@inheritdoc} |
|
30
|
|
|
*/ |
|
31
|
1 |
|
public function byFileName($fileName) { |
|
32
|
1 |
|
return $this->normalizeArray($this->sportsDbClient->doRequest('searchfilename.php', array('e' => $fileName))->event); |
|
33
|
|
|
} |
|
34
|
|
|
|
|
35
|
|
|
/** |
|
36
|
|
|
* {@inheritdoc} |
|
37
|
|
|
*/ |
|
38
|
1 |
|
public function byNameAndSeason($name, $season) { |
|
39
|
1 |
|
return $this->normalizeArray($this->sportsDbClient->doRequest('searchevents.php', array('e' => $name, 's' => $season))->event); |
|
40
|
|
|
} |
|
41
|
|
|
|
|
42
|
|
|
/** |
|
43
|
|
|
* {@inheritdoc} |
|
44
|
|
|
*/ |
|
45
|
1 |
|
public function nextFiveByTeam($teamId) { |
|
46
|
1 |
|
return $this->normalizeArray($this->sportsDbClient->doRequest('eventsnext.php', array('id' => $teamId))->events); |
|
47
|
|
|
} |
|
48
|
|
|
|
|
49
|
|
|
/** |
|
50
|
|
|
* {@inheritdoc} |
|
51
|
|
|
*/ |
|
52
|
1 |
|
public function nextFifteenByLeague($leagueId) { |
|
53
|
1 |
|
return $this->normalizeArray($this->sportsDbClient->doRequest('eventsnextleague.php', array('id' => $leagueId))->events); |
|
54
|
|
|
} |
|
55
|
|
|
|
|
56
|
|
|
/** |
|
57
|
|
|
* {@inheritdoc} |
|
58
|
|
|
*/ |
|
59
|
1 |
|
public function nextFifteenByLeagueAndRound($leagueId, $round) { |
|
60
|
1 |
|
return $this->normalizeArray($this->sportsDbClient->doRequest('eventsnextleague.php', array('id' => $leagueId, 'r' => $round))->events); |
|
61
|
|
|
} |
|
62
|
|
|
|
|
63
|
|
|
/** |
|
64
|
|
|
* {@inheritdoc} |
|
65
|
|
|
*/ |
|
66
|
1 |
|
public function lastFiveByTeam($teamId) { |
|
67
|
1 |
|
return $this->normalizeArray($this->sportsDbClient->doRequest('eventslast.php', array('id' => $teamId))->results); |
|
68
|
|
|
} |
|
69
|
|
|
|
|
70
|
|
|
/** |
|
71
|
|
|
* {@inheritdoc} |
|
72
|
|
|
*/ |
|
73
|
1 |
|
public function lastFifteenByLeague($leagueId) { |
|
74
|
1 |
|
return $this->normalizeArray($this->sportsDbClient->doRequest('eventspastleague.php', array('id' => $leagueId))->events); |
|
75
|
|
|
} |
|
76
|
|
|
|
|
77
|
|
|
/** |
|
78
|
|
|
* {@inheritdoc} |
|
79
|
|
|
*/ |
|
80
|
1 |
|
public function byDay(\DateTime $date, $sport = NULL, $leagueName = NULL) { |
|
81
|
1 |
|
return $this->normalizeArray($this->sportsDbClient->doRequest('eventsday.php', array('d' => $date->format('Y-m-d'), 's' => $sport, 'l' => $leagueName))->events); |
|
82
|
|
|
} |
|
83
|
|
|
|
|
84
|
|
|
/** |
|
85
|
|
|
* {@inheritdoc} |
|
86
|
|
|
*/ |
|
87
|
1 |
|
public function byLeagueRoundAndSeason($leagueId, $round, $season) { |
|
88
|
1 |
|
return $this->normalizeArray($this->sportsDbClient->doRequest('eventsround.php', array('id' => $leagueId, 'r' => $round, 's' => $season))->events); |
|
89
|
|
|
} |
|
90
|
|
|
|
|
91
|
|
|
/** |
|
92
|
|
|
* {@inheritdoc} |
|
93
|
|
|
*/ |
|
94
|
1 |
|
public function byLeagueAndSeason($leagueId, $season) { |
|
95
|
1 |
|
return $this->normalizeArray($this->sportsDbClient->doRequest('eventsseason.php', array('id' => $leagueId, 's' => $season))->events); |
|
96
|
|
|
} |
|
97
|
|
|
|
|
98
|
|
|
} |
|
99
|
|
|
|