Completed
Push — master ( 4b06b4...964845 )
by Jelle
03:57
created

Player   A

Complexity

Total Complexity 26

Size/Duplication

Total Lines 480
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 96.92%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 26
lcom 1
cbo 2
dl 0
loc 480
ccs 126
cts 130
cp 0.9692
rs 10
c 1
b 0
f 0

26 Methods

Rating   Name   Duplication   Size   Complexity  
A getId() 0 3 1
A getTeam() 0 3 1
A getNationality() 0 3 1
A getName() 0 3 1
A getSport() 0 3 1
A getBirthDay() 0 3 1
A getDateSigned() 0 3 1
A getSigning() 0 3 1
A getWage() 0 3 1
A getBirthLocation() 0 3 1
A getDescription() 0 3 1
A getGender() 0 3 1
A getPosition() 0 3 1
A getFacebook() 0 3 1
A getWebsite() 0 3 1
A getTwitter() 0 3 1
A getInstagram() 0 3 1
A getYoutube() 0 3 1
A getHeight() 0 3 1
A getWeight() 0 3 1
A getThumb() 0 3 1
A getCutout() 0 3 1
A getLocked() 0 3 1
A transformTeam() 0 3 1
A transformSport() 0 3 1
B initPropertyMapDefinition() 0 112 1
1
<?php
2
/**
3
 * @file
4
 * Contains \TheSportsDb\Entity\Player.
5
 */
6
7
namespace TheSportsDb\Entity;
8
9
use TheSportsDb\Entity\EntityManagerInterface;
10
use TheSportsDb\PropertyMapper\PropertyDefinition;
11
12
/**
13
 * A fully loaded player object.
14
 *
15
 * @author Jelle Sebreghts
16
 */
17
class Player extends Entity implements PlayerInterface {
18
19
  /**
20
   * {@inheritdoc}
21
   */
22
  protected static $propertyMapDefinition;
23
24
  /**
25
   * The primary identifier.
26
   *
27
   * @var mixed
28
   */
29
  protected $id;
30
31
  /**
32
   * The team.
33
   *
34
   * @var \TheSportsDb\Entity\TeamInterface
35
   */
36
  protected $team;
37
38
  /**
39
   * The nationality.
40
   *
41
   * @var string
42
   */
43
  protected $nationality;
44
45
  /**
46
   * The name.
47
   *
48
   * @var string
49
   */
50
  protected $name;
51
52
  /**
53
   * The sport.
54
   *
55
   * @var \TheSportsDb\Entity\SportInterface
56
   */
57
  protected $sport;
58
59
  /**
60
   * The birthday.
61
   *
62
   * @var string
63
   */
64
  protected $birthDay;
65
66
  /**
67
   * The date this player signed.
68
   *
69
   * @var string
70
   */
71
  protected $dateSigned;
72
73
  /**
74
   * The amount this player signed for.
75
   *
76
   * @var string
77
   */
78
  protected $signing;
79
80
  /**
81
   * The wage.
82
   *
83
   * @var string
84
   */
85
  protected $wage;
86
87
  /**
88
   * The birth location.
89
   *
90
   * @var string
91
   */
92
  protected $birthLocation;
93
94
  /**
95
   * The description.
96
   *
97
   * @var string
98
   */
99
  protected $description;
100
101
  /**
102
   * The gender.
103
   *
104
   * @var string
105
   */
106
  protected $gender;
107
108
  /**
109
   * The position.
110
   *
111
   * @var string
112
   */
113
  protected $position;
114
115
  /**
116
   * The facebook URL.
117
   *
118
   * @var string
119
   */
120
  protected $facebook;
121
122
  /**
123
   * The website URL.
124
   *
125
   * @var string
126
   */
127
  protected $website;
128
129
  /**
130
   * The twitter profile URL.
131
   *
132
   * @var string
133
   */
134
  protected $twitter;
135
136
  /**
137
   * The instagram URL.
138
   *
139
   * @var string
140
   */
141
  protected $instagram;
142
143
  /**
144
   * The youtube URL.
145
   *
146
   * @var string
147
   */
148
  protected $youtube;
149
150
  /**
151
   * The height.
152
   *
153
   * @var float
154
   */
155
  protected $height;
156
157
  /**
158
   * The weight.
159
   *
160
   * @var float
161
   */
162
  protected $weight;
163
164
  /**
165
   * The thumbnail URL.
166
   *
167
   * @var string
168
   */
169
  protected $thumb;
170
171
  /**
172
   * The cutout URL.
173
   *
174
   * @var string
175
   */
176
  protected $cutout;
177
178
  /**
179
   * Whether this player is locked or not.
180
   *
181
   * @var string
182
   */
183
  protected $locked;
184
185
  /**
186
   * {@inheritdoc}
187
   */
188 1
  public function getId() {
189 1
    return $this->id;
190
  }
191
192
  /**
193
   * {@inheritdoc}
194
   */
195 1
  public function getTeam() {
196 1
    return $this->team;
197
  }
198
199
  /**
200
   * {@inheritdoc}
201
   */
202 1
  public function getNationality() {
203 1
    return $this->nationality;
204
  }
205
206
  /**
207
   * {@inheritdoc}
208
   */
209 1
  public function getName() {
210 1
    return $this->name;
211
  }
212
213
  /**
214
   * {@inheritdoc}
215
   */
216 1
  public function getSport() {
217 1
    return $this->sport;
218
  }
219
220
  /**
221
   * {@inheritdoc}
222
   */
223 1
  public function getBirthDay() {
224 1
    return $this->birthDay;
225
  }
226
227
  /**
228
   * {@inheritdoc}
229
   */
230 1
  public function getDateSigned() {
231 1
    return $this->dateSigned;
232
  }
233
234
  /**
235
   * {@inheritdoc}
236
   */
237 1
  public function getSigning() {
238 1
    return $this->signing;
239
  }
240
241
  /**
242
   * {@inheritdoc}
243
   */
244 1
  public function getWage() {
245 1
    return $this->wage;
246
  }
247
248
  /**
249
   * {@inheritdoc}
250
   */
251 1
  public function getBirthLocation() {
252 1
    return $this->birthLocation;
253
  }
254
255
  /**
256
   * {@inheritdoc}
257
   */
258 1
  public function getDescription() {
259 1
    return $this->description;
260
  }
261
262
  /**
263
   * {@inheritdoc}
264
   */
265 1
  public function getGender() {
266 1
    return $this->gender;
267
  }
268
269
  /**
270
   * {@inheritdoc}
271
   */
272 1
  public function getPosition() {
273 1
    return $this->position;
274
  }
275
276
  /**
277
   * {@inheritdoc}
278
   */
279 1
  public function getFacebook() {
280 1
    return $this->facebook;
281
  }
282
283
  /**
284
   * {@inheritdoc}
285
   */
286 1
  public function getWebsite() {
287 1
    return $this->website;
288
  }
289
290
  /**
291
   * {@inheritdoc}
292
   */
293 1
  public function getTwitter() {
294 1
    return $this->twitter;
295
  }
296
297
  /**
298
   * {@inheritdoc}
299
   */
300 1
  public function getInstagram() {
301 1
    return $this->instagram;
302
  }
303
304
  /**
305
   * {@inheritdoc}
306
   */
307 1
  public function getYoutube() {
308 1
    return $this->youtube;
309
  }
310
311
  /**
312
   * {@inheritdoc}
313
   */
314 1
  public function getHeight() {
315 1
    return $this->height;
316
  }
317
318
  /**
319
   * {@inheritdoc}
320
   */
321 1
  public function getWeight() {
322 1
    return $this->weight;
323
  }
324
325
  /**
326
   * {@inheritdoc}
327
   */
328 1
  public function getThumb() {
329 1
    return $this->thumb;
330
  }
331
332
  /**
333
   * {@inheritdoc}
334
   */
335 1
  public function getCutout() {
336 1
    return $this->cutout;
337
  }
338
339
  /**
340
   * {@inheritdoc}
341
   */
342 1
  public function getLocked() {
343 1
    return $this->locked;
344
  }
345
346
  /**
347
   * Transforms the team property to a team entity.
348
   *
349
   * @param mixed $value
350
   *   The source value of the team property.
351
   * @param \stdClass $context
352
   *   The source object representing this player.
353
   * @param EntityManagerInterface $entityManager
354
   *   The entity manager.
355
   *
356
   * @return \TheSportsDb\Entity\TeamInterface
357
   *   The team entity.
358
   */
359
  public static function transformTeam($value, $context, EntityManagerInterface $entityManager) {
360
    return static::transform($value, $context, $entityManager, 'team', 'idTeam', array('strTeam' => 'strTeam'));
361
  }
362
363
  /**
364
   * Transforms the sport property to a sport entity.
365
   *
366
   * @param mixed $value
367
   *   The source value of the sport property.
368
   * @param \stdClass $context
369
   *   The source object representing this player.
370
   * @param EntityManagerInterface $entityManager
371
   *   The entity manager.
372
   *
373
   * @return \TheSportsDb\Entity\SportInterface
374
   *   The sport entity.
375
   */
376
  public static function transformSport($value, $context, EntityManagerInterface $entityManager) {
377
    return static::transform($value, $context, $entityManager, 'sport', 'strSport');
378
  }
379
380
  /**
381
   * {@inheritdoc}
382
   */
383 1
  protected static function initPropertyMapDefinition() {
384 1
    static::$propertyMapDefinition
385 1
      ->addPropertyMap(
386 1
        new PropertyDefinition('idPlayer'),
387 1
        new PropertyDefinition('id')
388
      )
389 1
      ->addPropertyMap(
390 1
        new PropertyDefinition('idTeam'),
391 1
        new PropertyDefinition('team'),
392 1
        [self::class, 'transformTeam'],
393 1
        [Team::class, 'reverse']
394
      )
395 1
      ->addPropertyMap(
396 1
        new PropertyDefinition('strNationality'),
397 1
        new PropertyDefinition('nationality')
398
      )
399 1
      ->addPropertyMap(
400 1
        new PropertyDefinition('strPlayer'),
401 1
        new PropertyDefinition('name')
402
      )
403 1
      ->addPropertyMap(
404 1
        new PropertyDefinition('strSport'),
405 1
        new PropertyDefinition('sport', 'sport'),
406 1
        [self::class, 'transformSport'],
407 1
        [Sport::class, 'reverse']
408
      )
409 1
      ->addPropertyMap(
410 1
        new PropertyDefinition('dateBorn'),
411 1
        new PropertyDefinition('birthDay'),
412 1
        [self::class, 'transformDateDefault'],
413 1
        [self::class, 'reverseDateDefault']
414
      )
415 1
      ->addPropertyMap(
416 1
        new PropertyDefinition('dateSigned'),
417 1
        new PropertyDefinition('dateSigned'),
418 1
        [self::class, 'transformDateDefault'],
419 1
        [self::class, 'reverseDateDefault']
420
      )
421 1
      ->addPropertyMap(
422 1
        new PropertyDefinition('strSigning'),
423 1
        new PropertyDefinition('signing')
424
      )
425 1
      ->addPropertyMap(
426 1
        new PropertyDefinition('strWage'),
427 1
        new PropertyDefinition('wage')
428
      )
429 1
      ->addPropertyMap(
430 1
        new PropertyDefinition('strBirthLocation'),
431 1
        new PropertyDefinition('birthLocation')
432
      )
433 1
      ->addPropertyMap(
434 1
        new PropertyDefinition('strDescriptionEN'),
435 1
        new PropertyDefinition('description')
436
      )
437 1
      ->addPropertyMap(
438 1
        new PropertyDefinition('strGender'),
439 1
        new PropertyDefinition('gender')
440
      )
441 1
      ->addPropertyMap(
442 1
        new PropertyDefinition('strPosition'),
443 1
        new PropertyDefinition('position')
444
      )
445 1
      ->addPropertyMap(
446 1
        new PropertyDefinition('strFacebook'),
447 1
        new PropertyDefinition('facebook')
448
      )
449 1
      ->addPropertyMap(
450 1
        new PropertyDefinition('strWebsite'),
451 1
        new PropertyDefinition('website')
452
      )
453 1
      ->addPropertyMap(
454 1
        new PropertyDefinition('strTwitter'),
455 1
        new PropertyDefinition('strTwitter')
456
      )
457 1
      ->addPropertyMap(
458 1
        new PropertyDefinition('strInstagram'),
459 1
        new PropertyDefinition('instagram')
460
      )
461 1
      ->addPropertyMap(
462 1
        new PropertyDefinition('strYoutube'),
463 1
        new PropertyDefinition('youtube')
464
      )
465 1
      ->addPropertyMap(
466 1
        new PropertyDefinition('strHeight'),
467 1
        new PropertyDefinition('height')
468
      )
469 1
      ->addPropertyMap(
470 1
        new PropertyDefinition('strWeight'),
471 1
        new PropertyDefinition('weight')
472
      )
473 1
      ->addPropertyMap(
474 1
        new PropertyDefinition('strThumb'),
475 1
        new PropertyDefinition('thumb')
476
      )
477 1
      ->addPropertyMap(
478 1
        new PropertyDefinition('strCutout'),
479 1
        new PropertyDefinition('strCutout')
480
      )
481 1
      ->addPropertyMap(
482 1
        new PropertyDefinition('strLocked'),
483 1
        new PropertyDefinition('locked')
484
      );
485
      // idSoccerXML
486
      // idPlayerManager
487
      // intSoccerXMLTeamID
488
      // strCollege
489
      // intLoved
490
      // strFanart1
491
      // strFanart2
492
      // strFanart3
493
      // strFanart4
494 1
  }
495
496
}
497