Completed
Push — master ( db3a5a...bd914c )
by Jelle
10:58
created

TeamRepository   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 1 Features 0
Metric Value
wmc 4
lcom 1
cbo 2
dl 0
loc 36
ccs 8
cts 8
cp 1
rs 10
c 1
b 1
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A byName() 0 3 1
A byLeagueName() 0 3 1
A bySportAndCountry() 0 3 1
A byLeague() 0 3 1
1
<?php
2
/**
3
 * @file
4
 * Contains \TheSportsDb\Entity\Repository\TeamRepository.
5
 */
6
7
namespace TheSportsDb\Entity\Repository;
8
9
/**
10
 * The default TeamRepository implementation.
11
 *
12
 * @author Jelle Sebreghts
13
 */
14
class TeamRepository extends Repository implements TeamRepositoryInterface {
15
16
  /**
17
   * {@inheritdoc}
18
   */
19
  protected $entityType = 'team';
20
21
  /**
22
   * {@inheritdoc}
23
   */
24 1
  public function byName($name) {
25 1
    return $this->normalizeArray($this->sportsDbClient->doRequest('searchteams.php', array('t' => $name))->teams);
26
  }
27
28
  /**
29
   * {@inheritdoc}
30
   */
31 1
  public function byLeagueName($leagueName) {
32 1
    return $this->normalizeArray($this->sportsDbClient->doRequest('search_all_teams.php', array('l' => $leagueName))->teams);
33
  }
34
35
  /**
36
   * {@inheritdoc}
37
   */
38 1
  public function bySportAndCountry($sport, $country) {
39 1
    return $this->normalizeArray($this->sportsDbClient->doRequest('search_all_teams.php', array('s' => $sport, 'c' => $country))->teams);
40
  }
41
42
  /**
43
   * {@inheritdoc}
44
   */
45 1
  public function byLeague($leagueId) {
46 1
    return $this->normalizeArray($this->sportsDbClient->doRequest('lookup_all_teams.php', array('id' => $leagueId))->teams);
47
  }
48
49
}
50