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

TheSportsDb::getLastFifteenEventsByLeague()   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 1
1
<?php
2
/**
3
 * @file
4
 * The main sportsdb class.
5
 */
6
7
namespace TheSportsDb;
8
9
use TheSportsDb\Entity\EntityManagerConsumerInterface;
10
use TheSportsDb\Entity\EntityManagerConsumerTrait;
11
use TheSportsDb\Entity\EntityManagerInterface;
12
13
/**
14
 * Main API class for TheSportsDb.
15
 *
16
 * @author Jelle Sebreghts
17
 */
18
class TheSportsDb implements EntityManagerConsumerInterface {
19
20
  use EntityManagerConsumerTrait;
21
22
  /**
23
   * Creates a new TheSportsDb instance
24
   */
25
  public function __construct(EntityManagerInterface $entityManager = NULL) {
26
    if ($entityManager instanceof EntityManagerInterface) {
27
      $this->entityManager = $entityManager;
28
    }
29
  }
30
31
  public function getSports() {
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
32
    return $this->entityManager->repository('sport')->all();
33
  }
34
35
  /**
36
   * Get a sport by name.
37
   *
38
   * @param string $name
39
   *   The sport name.
40
   *
41
   * @return \TheSportsDb\Entity\SportInterface
42
   */
43
  public function getSport($name) {
44
    return $this->entityManager->repository('sport')->byId($name);
45
  }
46
47
  public function getLeagues() {
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
48
    return $this->entityManager->repository('league')->all();
49
  }
50
51
  /**
52
   * Get a league by id.
53
   *
54
   * @param int $leagueId
55
   *   The league id.
56
   *
57
   * @return \TheSportsDb\Entity\LeagueInterface
58
   */
59
  public function getLeague($leagueId) {
60
    return $this->entityManager->repository('league')->byId($leagueId);
61
  }
62
63
  public function getLeaguesByCountry($country) {
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
64
    return $this->entityManager->repository('league')->byCountry($country);
65
  }
66
67
  public function getLeaguesBySport($sport) {
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
68
    return $this->entityManager->repository('league')->bySport($sport);
69
  }
70
71
  public function getLeaguesByCountryAndSport($country, $sport) {
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
72
    return $this->entityManager->repository('league')->byCountryAndSport($country, $sport);
73
  }
74
75
  public function getTeam($teamId) {
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
76
    return $this->entityManager->repository('team')->byId($teamId);
77
  }
78
79
    public function getTeamByName($teamName) {
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
80
    return $this->entityManager->repository('team')->byName($teamName);
81
  }
82
83
  public function getTeamsByLeague($leagueId) {
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
84
    return $this->entityManager->repository('team')->byLeague($leagueId);
85
  }
86
87
  public function getTeamsByLeagueName($leagueName) {
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
88
    return $this->entityManager->repository('team')->byLeagueName($leagueName);
89
  }
90
91
  public function getTeamsBySportAndCountry($sport, $country) {
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
92
    return $this->entityManager->repository('team')->bySportAndCountry($sport, $country);
93
  }
94
95
  public function getPlayer($playerId) {
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
96
    return $this->entityManager->repository('player')->byId($playerId);
97
  }
98
99
  public function getPlayersByTeam($teamId) {
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
100
    return $this->entityManager->repository('player')->byTeam($teamId);
101
  }
102
103
  public function getPlayersByTeamName($teamName) {
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
104
    return $this->entityManager->repository('player')->byTeamName($teamName);
105
  }
106
107
  public function getPlayersByName($teamName) {
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
108
    return $this->entityManager->repository('player')->byName($teamName);
109
  }
110
111
  public function getPlayersByTeamNameAndName($teamName, $name) {
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
112
    return $this->entityManager->repository('player')->byTeamNameAndName($teamName, $name);
113
  }
114
115
  public function getEvent($eventId) {
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
116
    return $this->entityManager->repository('event')->byId($eventId);
117
  }
118
119
  public function getEventsByName($name) {
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
120
    return $this->entityManager->repository('event')->byName($name);
121
  }
122
123
  public function getEventsByFileName($name) {
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
124
    return $this->entityManager->repository('event')->byFileName($name);
125
  }
126
127
  public function getEventsByNameAndSeason($name, $season) {
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
128
    return $this->entityManager->repository('event')->byNameAndSeason($name, $season);
129
  }
130
131
  public function getNextFiveEventsByTeam($teamId) {
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
132
    return $this->entityManager->repository('event')->nextFiveByTeam($teamId);
133
  }
134
135
  public function getNextFifteenEventsByLeague($leagueId) {
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
136
    return $this->entityManager->repository('event')->nextFifteenEventsByLeague($leagueId);
137
  }
138
139
  public function getNextFifteenEventsByLeagueAndRound($leagueId, $round) {
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
140
    return $this->entityManager->repository('event')->nextFifteenEventsByLeagueAndRound($leagueId, $round);
141
  }
142
143
  public function getLastFiveEventsByTeam($teamId) {
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
144
    return $this->entityManager->repository('event')->lastFiveByTeam($teamId);
145
  }
146
147
  public function getLastFifteenEventsByLeague($leagueId) {
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
148
    return $this->entityManager->repository('event')->lastFifteenEventsByLeague($leagueId);
149
  }
150
151
  public function getEventsByDay(\DateTime $date, $sport = NULL, $leagueName = NULL) {
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
152
    return $this->entityManager->repository('event')->byDay($date, $sport, $leagueName);
153
  }
154
155
  public function getEventsByLeagueRoundAndSeason($leagueId, $round, $season) {
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
156
    return $this->entityManager->repository('event')->byLeagueRoundAndSeason($leagueId, $round, $season);
157
  }
158
159
  public function getEventsByLeagueAndSeason($leagueId, $season) {
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
160
    return $this->entityManager->repository('event')->byLeagueAndSeason($leagueId, $season);
161
  }
162
163
  public function getSeasonsByLeague($leagueId) {
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
164
    return $this->entityManager->repository('season')->byLeague($leagueId);
165
  }
166
}
167