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

EventRepository   A

Complexity

Total Complexity 11

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 4
Bugs 0 Features 2
Metric Value
wmc 11
c 4
b 0
f 2
lcom 1
cbo 2
dl 0
loc 48
rs 10

11 Methods

Rating   Name   Duplication   Size   Complexity  
A byName() 0 3 1
A byFileName() 0 3 1
A byNameAndSeason() 0 3 1
A nextFiveByTeam() 0 3 1
A nextFifteenEventsByLeague() 0 3 1
A nextFifteenEventsByLeagueAndRound() 0 3 1
A lastFiveByTeam() 0 3 1
A lastFifteenEventsByLeague() 0 3 1
A byDay() 0 3 1
A byLeagueRoundAndSeason() 0 3 1
A byLeagueAndSeason() 0 3 1
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