1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* @file |
4
|
|
|
* Contains \TheSportsDb\Entity\Proxy\Player. |
5
|
|
|
*/ |
6
|
|
|
|
7
|
|
|
namespace TheSportsDb\Entity\Proxy; |
8
|
|
|
|
9
|
|
|
use TheSportsDb\Entity\PlayerInterface; |
10
|
|
|
|
11
|
|
|
/** |
12
|
|
|
* A fully loaded player object. |
13
|
|
|
* |
14
|
|
|
* @author Jelle Sebreghts |
15
|
|
|
*/ |
16
|
|
|
class PlayerProxy extends Proxy implements PlayerInterface { |
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* {@inheritdoc} |
20
|
|
|
*/ |
21
|
|
View Code Duplication |
public function load() { |
|
|
|
|
22
|
|
|
$playerData = $this->sportsDbClient->doRequest('lookupplayer.php', array('id' => $this->properties->id)); |
23
|
|
|
if (isset($playerData->players)) { |
24
|
|
|
$this->update($this->entityManager->mapProperties(reset($playerData->players), $this->getEntityType())); |
25
|
|
|
return; |
26
|
|
|
} |
27
|
|
|
throw new \Exception('Could not fully load player with id ' . $this->properties->id . '.'); |
28
|
|
|
} |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* {@inheritdoc} |
32
|
|
|
*/ |
33
|
1 |
|
public function getId() { |
34
|
1 |
|
return $this->get('id'); |
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* {@inheritdoc} |
39
|
|
|
*/ |
40
|
1 |
|
public function getTeam() { |
41
|
1 |
|
return $this->get('team'); |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* {@inheritdoc} |
46
|
|
|
*/ |
47
|
1 |
|
public function getNationality() { |
48
|
1 |
|
return $this->get('nationality'); |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* {@inheritdoc} |
53
|
|
|
*/ |
54
|
1 |
|
public function getName() { |
55
|
1 |
|
return $this->get('name'); |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* {@inheritdoc} |
60
|
|
|
*/ |
61
|
1 |
|
public function getSport() { |
62
|
1 |
|
return $this->get('sport'); |
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* {@inheritdoc} |
67
|
|
|
*/ |
68
|
1 |
|
public function getBirthDay() { |
69
|
1 |
|
return $this->get('birthDay'); |
70
|
|
|
} |
71
|
|
|
|
72
|
|
|
/** |
73
|
|
|
* {@inheritdoc} |
74
|
|
|
*/ |
75
|
1 |
|
public function getDateSigned() { |
76
|
1 |
|
return $this->get('dateSigned'); |
77
|
|
|
} |
78
|
|
|
|
79
|
|
|
/** |
80
|
|
|
* {@inheritdoc} |
81
|
|
|
*/ |
82
|
1 |
|
public function getSigning() { |
83
|
1 |
|
return $this->get('signing'); |
84
|
|
|
} |
85
|
|
|
|
86
|
|
|
/** |
87
|
|
|
* {@inheritdoc} |
88
|
|
|
*/ |
89
|
1 |
|
public function getWage() { |
90
|
1 |
|
return $this->get('wage'); |
91
|
|
|
} |
92
|
|
|
|
93
|
|
|
/** |
94
|
|
|
* {@inheritdoc} |
95
|
|
|
*/ |
96
|
1 |
|
public function getBirthLocation() { |
97
|
1 |
|
return $this->get('birthLocation'); |
98
|
|
|
} |
99
|
|
|
|
100
|
|
|
/** |
101
|
|
|
* {@inheritdoc} |
102
|
|
|
*/ |
103
|
1 |
|
public function getDescription() { |
104
|
1 |
|
return $this->get('description'); |
105
|
|
|
} |
106
|
|
|
|
107
|
|
|
/** |
108
|
|
|
* {@inheritdoc} |
109
|
|
|
*/ |
110
|
1 |
|
public function getGender() { |
111
|
1 |
|
return $this->get('gender'); |
112
|
|
|
} |
113
|
|
|
|
114
|
|
|
/** |
115
|
|
|
* {@inheritdoc} |
116
|
|
|
*/ |
117
|
1 |
|
public function getPosition() { |
118
|
1 |
|
return $this->get('position'); |
119
|
|
|
} |
120
|
|
|
|
121
|
|
|
/** |
122
|
|
|
* {@inheritdoc} |
123
|
|
|
*/ |
124
|
1 |
|
public function getFacebook() { |
125
|
1 |
|
return $this->get('facebook'); |
126
|
|
|
} |
127
|
|
|
|
128
|
|
|
/** |
129
|
|
|
* {@inheritdoc} |
130
|
|
|
*/ |
131
|
1 |
|
public function getWebsite() { |
132
|
1 |
|
return $this->get('website'); |
133
|
|
|
} |
134
|
|
|
|
135
|
|
|
/** |
136
|
|
|
* {@inheritdoc} |
137
|
|
|
*/ |
138
|
1 |
|
public function getTwitter() { |
139
|
1 |
|
return $this->get('twitter'); |
140
|
|
|
} |
141
|
|
|
|
142
|
|
|
/** |
143
|
|
|
* {@inheritdoc} |
144
|
|
|
*/ |
145
|
1 |
|
public function getInstagram() { |
146
|
1 |
|
return $this->get('instagram'); |
147
|
|
|
} |
148
|
|
|
|
149
|
|
|
/** |
150
|
|
|
* {@inheritdoc} |
151
|
|
|
*/ |
152
|
1 |
|
public function getYoutube() { |
153
|
1 |
|
return $this->get('youtube'); |
154
|
|
|
} |
155
|
|
|
|
156
|
|
|
/** |
157
|
|
|
* {@inheritdoc} |
158
|
|
|
*/ |
159
|
1 |
|
public function getHeight() { |
160
|
1 |
|
return $this->get('height'); |
161
|
|
|
} |
162
|
|
|
|
163
|
|
|
/** |
164
|
|
|
* {@inheritdoc} |
165
|
|
|
*/ |
166
|
1 |
|
public function getWeight() { |
167
|
1 |
|
return $this->get('weight'); |
168
|
|
|
} |
169
|
|
|
|
170
|
|
|
/** |
171
|
|
|
* {@inheritdoc} |
172
|
|
|
*/ |
173
|
1 |
|
public function getThumb() { |
174
|
1 |
|
return $this->get('thumb'); |
175
|
|
|
} |
176
|
|
|
|
177
|
|
|
/** |
178
|
|
|
* {@inheritdoc} |
179
|
|
|
*/ |
180
|
1 |
|
public function getCutout() { |
181
|
1 |
|
return $this->get('cutout'); |
182
|
|
|
} |
183
|
|
|
|
184
|
|
|
/** |
185
|
|
|
* {@inheritdoc} |
186
|
|
|
*/ |
187
|
1 |
|
public function getLocked() { |
188
|
1 |
|
return $this->get('locked'); |
189
|
|
|
} |
190
|
|
|
} |
191
|
|
|
|
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.