Completed
Push — master ( d50bf3...fd592e )
by Jelle
02:47
created

EventRepository::byLeagueRoundAndSeason()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
eloc 2
nc 1
nop 3
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
  protected $entityType = 'event';
17
  public function byName($name) {
18
    return $this->normalizeArray($this->sportsDbClient->doRequest('searchevents.php', array('e' => $name))->event);
19
  }
20
21
  public function byFileName($fileName) {
22
    return $this->normalizeArray($this->sportsDbClient->doRequest('searchfilename.php', array('e' => $fileName))->event);
23
  }
24
25
  public function byNameAndSeason($name, $season) {
26
    return $this->normalizeArray($this->sportsDbClient->doRequest('searchevents.php', array('e' => $name, 's' => $season))->event);
27
  }
28
29
  public function nextFiveByTeam($teamId) {
30
    return $this->normalizeArray($this->sportsDbClient->doRequest('eventsnext.php', array('id' => $teamId))->events);
31
  }
32
33
  public function nextFifteenEventsByLeague($leagueId) {
34
    return $this->normalizeArray($this->sportsDbClient->doRequest('eventsnextleague.php', array('id' => $leagueId))->events);
35
  }
36
37
  public function nextFifteenEventsByLeagueAndRound($leagueId, $round) {
38
    return $this->normalizeArray($this->sportsDbClient->doRequest('eventsnextleague.php', array('id' => $leagueId, 'r' => $round))->events);
39
  }
40
41
  public function lastFiveByTeam($teamId) {
42
    return $this->normalizeArray($this->sportsDbClient->doRequest('eventslast.php', array('id' => $teamId))->events);
43
  }
44
45
  public function lastFifteenEventsByLeague($leagueId) {
46
    return $this->normalizeArray($this->sportsDbClient->doRequest('eventspastleague.php', array('id' => $leagueId))->events);
47
  }
48
49
  public function byDay(\DateTime $date, $sport = NULL, $leagueName = NULL) {
50
    return $this->normalizeArray($this->sportsDbClient->doRequest('eventsday.php', array('d' => $date->format('Y-m-d'), 's' => $sport, 'l' => $leagueName))->events);
51
  }
52
53
  public function byLeagueRoundAndSeason($leagueId, $round, $season) {
54
    return $this->normalizeArray($this->sportsDbClient->doRequest('eventsround.php', array('id' => $leagueId, 'r' => $round, 's' => $season))->events);
55
  }
56
57
  public function byLeagueAndSeason($leagueId, $season) {
58
    return $this->normalizeArray($this->sportsDbClient->doRequest('eventsseason.php', array('id' => $leagueId, 's' => $season))->events);
59
  }
60
61
}
62