TeamProxy   A
last analyzed

Complexity

Total Complexity 31

Size/Duplication

Total Lines 218
Duplicated Lines 3.67 %

Coupling/Cohesion

Components 2
Dependencies 3

Test Coverage

Coverage 90.63%

Importance

Changes 0
Metric Value
wmc 31
lcom 2
cbo 3
dl 8
loc 218
ccs 58
cts 64
cp 0.9063
rs 9.92
c 0
b 0
f 0

30 Methods

Rating   Name   Duplication   Size   Complexity  
A load() 8 8 2
A getAlternateName() 0 3 1
A getBadge() 0 3 1
A getBanner() 0 3 1
A getCountry() 0 3 1
A getDescription() 0 3 1
A getDivision() 0 3 1
A getFacebook() 0 3 1
A getFormedYear() 0 3 1
A getGender() 0 3 1
A getId() 0 3 1
A getInstagram() 0 3 1
A getJersey() 0 3 1
A getKeywords() 0 3 1
A getLeague() 0 3 1
A getLocked() 0 3 1
A getLogo() 0 3 1
A getManager() 0 3 1
A getRss() 0 3 1
A getSport() 0 3 1
A getStadium() 0 3 1
A getStadiumCapacity() 0 3 1
A getStadiumDescription() 0 3 1
A getStadiumLocation() 0 3 1
A getStadiumThumb() 0 3 1
A getName() 0 3 1
A getTeamShort() 0 3 1
A getTwitter() 0 3 1
A getWebsite() 0 3 1
A getYoutube() 0 3 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
/**
3
 * @file
4
 * Contains \TheSportsDb\Entity\Proxy\TeamProxy.
5
 */
6
7
namespace TheSportsDb\Entity\Proxy;
8
9
use TheSportsDb\Entity\TeamInterface;
10
11
/**
12
 * A team object that is not yet fully loaded.
13
 *
14
 * @author Jelle Sebreghts
15
 */
16
class TeamProxy extends Proxy implements TeamInterface {
17
18
  /**
19
   * {@inheritdoc}
20
   */
21 View Code Duplication
  public function load() {
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
22
    $teamData = $this->sportsDbClient->doRequest('lookupteam.php', array('id' => $this->properties->id));
23
    if (isset($teamData->teams)) {
24
      $this->update($this->entityManager->mapProperties(reset($teamData->teams), $this->getEntityType()));
25
      return;
26
    }
27
    throw new \Exception('Could not fully load team with id ' . $this->properties->id . '.');
28
  }
29
30
  /**
31
   * {@inheritdoc}
32
   */
33 1
  public function getAlternateName() {
34 1
    return $this->get('alternateName');
35
  }
36
37
  /**
38
   * {@inheritdoc}
39
   */
40 1
  public function getBadge() {
41 1
    return $this->get('badge');
42
  }
43
44
  /**
45
   * {@inheritdoc}
46
   */
47 1
  public function getBanner() {
48 1
    return $this->get('banner');
49
  }
50
51
  /**
52
   * {@inheritdoc}
53
   */
54 1
  public function getCountry() {
55 1
    return $this->get('country');
56
  }
57
58
  /**
59
   * {@inheritdoc}
60
   */
61 1
  public function getDescription() {
62 1
    return $this->get('description');
63
  }
64
65
  /**
66
   * {@inheritdoc}
67
   */
68 1
  public function getDivision() {
69 1
    return $this->get('division');
70
  }
71
72
  /**
73
   * {@inheritdoc}
74
   */
75 1
  public function getFacebook() {
76 1
    return $this->get('facebook');
77
  }
78
79
  /**
80
   * {@inheritdoc}
81
   */
82 1
  public function getFormedYear() {
83 1
    return $this->get('formedYear');
84
  }
85
86
  /**
87
   * {@inheritdoc}
88
   */
89 1
  public function getGender() {
90 1
    return $this->get('gender');
91
  }
92
93
  /**
94
   * {@inheritdoc}
95
   */
96 1
  public function getId() {
97 1
    return $this->get('id');
98
  }
99
100
  /**
101
   * {@inheritdoc}
102
   */
103 1
  public function getInstagram() {
104 1
    return $this->get('instagram');
105
  }
106
107
  /**
108
   * {@inheritdoc}
109
   */
110 1
  public function getJersey() {
111 1
    return $this->get('jersey');
112
  }
113
114
  /**
115
   * {@inheritdoc}
116
   */
117 1
  public function getKeywords() {
118 1
    return $this->get('keywords');
119
  }
120
121
  /**
122
   * {@inheritdoc}
123
   */
124 1
  public function getLeague() {
125 1
    return $this->get('league');
126
  }
127
128
  /**
129
   * {@inheritdoc}
130
   */
131 1
  public function getLocked() {
132 1
    return $this->get('locked');
133
  }
134
135
  /**
136
   * {@inheritdoc}
137
   */
138 1
  public function getLogo() {
139 1
    return $this->get('logo');
140
  }
141
142
  /**
143
   * {@inheritdoc}
144
   */
145 1
  public function getManager() {
146 1
    return $this->get('manager');
147
  }
148
149
  /**
150
   * {@inheritdoc}
151
   */
152 1
  public function getRss() {
153 1
    return $this->get('rss');
154
  }
155
156
  /**
157
   * {@inheritdoc}
158
   */
159 1
  public function getSport() {
160 1
    return $this->get('sport');
161
  }
162
163
  /**
164
   * {@inheritdoc}
165
   */
166 1
  public function getStadium() {
167 1
    return $this->get('stadium');
168
  }
169
170
  /**
171
   * {@inheritdoc}
172
   */
173 1
  public function getStadiumCapacity() {
174 1
    return $this->get('stadiumCapacity');
175
  }
176
177
  /**
178
   * {@inheritdoc}
179
   */
180 1
  public function getStadiumDescription() {
181 1
    return $this->get('stadiumDescription');
182
  }
183
184
  /**
185
   * {@inheritdoc}
186
   */
187 1
  public function getStadiumLocation() {
188 1
    return $this->get('stadiumLocation');
189
  }
190
191
  /**
192
   * {@inheritdoc}
193
   */
194 1
  public function getStadiumThumb() {
195 1
    return $this->get('stadiumThumb');
196
  }
197
198
  /**
199
   * {@inheritdoc}
200
   */
201 1
  public function getName() {
202 1
    return $this->get('name');
203
  }
204
205
  /**
206
   * {@inheritdoc}
207
   */
208 1
  public function getTeamShort() {
209 1
    return $this->get('teamShort');
210
  }
211
212
  /**
213
   * {@inheritdoc}
214
   */
215 1
  public function getTwitter() {
216 1
    return $this->get('twitter');
217
  }
218
219
  /**
220
   * {@inheritdoc}
221
   */
222 1
  public function getWebsite() {
223 1
    return $this->get('website');
224
  }
225
226
  /**
227
   * {@inheritdoc}
228
   */
229 1
  public function getYoutube() {
230 1
    return $this->get('youtube');
231
  }
232
233
}
234