Completed
Push — master ( 64cadb...9a4f3f )
by Jelle
04:20
created

Team   A

Complexity

Total Complexity 32

Size/Duplication

Total Lines 597
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 97.44%

Importance

Changes 3
Bugs 0 Features 0
Metric Value
wmc 32
c 3
b 0
f 0
lcom 1
cbo 2
dl 0
loc 597
ccs 152
cts 156
cp 0.9744
rs 9.6

32 Methods

Rating   Name   Duplication   Size   Complexity  
A getName() 0 3 1
A getId() 0 3 1
A getTeamShort() 0 3 1
A getAlternateName() 0 3 1
A getFormedYear() 0 3 1
A getSport() 0 3 1
A getLeague() 0 3 1
A getDivision() 0 3 1
A getManager() 0 3 1
A getStadium() 0 3 1
A getKeywords() 0 3 1
A getRss() 0 3 1
A getStadiumThumb() 0 3 1
A getStadiumDescription() 0 3 1
A getStadiumLocation() 0 3 1
A getStadiumCapacity() 0 3 1
A getWebsite() 0 3 1
A getFacebook() 0 3 1
A getTwitter() 0 3 1
A getInstagram() 0 3 1
A getDescription() 0 3 1
A getGender() 0 3 1
A getCountry() 0 3 1
A getBadge() 0 3 1
A getJersey() 0 3 1
A getLogo() 0 3 1
A getBanner() 0 3 1
A getYoutube() 0 3 1
A getLocked() 0 3 1
A transformSport() 0 3 1
A transformLeague() 0 3 1
B initPropertyMapDefinition() 0 144 1
1
<?php
2
/**
3
 * @file
4
 * Contains \TheSportsDb\Entity\Team.
5
 */
6
7
namespace TheSportsDb\Entity;
8
9
use TheSportsDb\Entity\EntityManagerInterface;
10
use TheSportsDb\PropertyMapper\PropertyDefinition;
11
12
/**
13
 * A fully loaded team object.
14
 *
15
 * @author Jelle Sebreghts
16
 */
17
class Team extends Entity implements TeamInterface {
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 name.
33
   *
34
   * @var string
35
   */
36
  protected $name;
37
38
  /**
39
   * The short name.
40
   *
41
   * @var string
42
   */
43
  protected $teamShort;
44
45
  /**
46
   * The alternate name
47
   *
48
   * @var string
49
   */
50
  protected $alternateName;
51
52
  /**
53
   * The year the team was formed.
54
   *
55
   * @var int
56
   */
57
  protected $formedYear;
58
59
  /**
60
   * The sport of this team.
61
   *
62
   * @var \TheSportsDb\Entity\SportInterface
63
   */
64
  protected $sport;
65
66
  /**
67
   * The league of this team.
68
   *
69
   * @var \TheSportsDb\Entity\LeagueInterface
70
   */
71
  protected $league;
72
73
  /**
74
   * The division.
75
   *
76
   * @var string
77
   */
78
  protected $division;
79
80
  /**
81
   * The manager.
82
   *
83
   * @var string
84
   */
85
  protected $manager;
86
87
  /**
88
   * The stadium.
89
   *
90
   * @var string
91
   */
92
  protected $stadium;
93
94
  /**
95
   * The keywords.
96
   *
97
   * @var string
98
   */
99
  protected $keywords;
100
101
  /**
102
   * The URL of the RSS feed.
103
   *
104
   * @var string
105
   */
106
  protected $rss;
107
108
  /**
109
   * The URL of the stadium thumbnail.
110
   *
111
   * @var string
112
   */
113
  protected $stadiumThumb;
114
115
  /**
116
   * The stadium description.
117
   *
118
   * @var string
119
   */
120
  protected $stadiumDescription;
121
122
  /**
123
   * The stadium location.
124
   *
125
   * @var string
126
   */
127
  protected $stadiumLocation;
128
129
  /**
130
   * The stadium location.
131
   *
132
   * @var int
133
   */
134
  protected $stadiumCapacity;
135
136
  /**
137
   * The URL to the website.
138
   *
139
   * @var string
140
   */
141
  protected $website;
142
143
  /**
144
   * The URL to the facebook page.
145
   *
146
   * @var string
147
   */
148
  protected $facebook;
149
150
  /**
151
   * The URL to the twitter profile.
152
   *
153
   * @var string
154
   */
155
  protected $twitter;
156
157
  /**
158
   * The URL to the instagram page.
159
   *
160
   * @var string
161
   */
162
  protected $instagram;
163
164
  /**
165
   * The description.
166
   *
167
   * @var string
168
   */
169
  protected $description;
170
171
  /**
172
   * The gender.
173
   *
174
   * @var string
175
   */
176
  protected $gender;
177
178
  /**
179
   * The country.
180
   *
181
   * @var string
182
   */
183
  protected $country;
184
185
  /**
186
   * The URL to the badge.
187
   *
188
   * @var string
189
   */
190
  protected $badge;
191
192
  /**
193
   * The URL to the jersey.
194
   *
195
   * @var string
196
   */
197
  protected $jersey;
198
199
  /**
200
   * The URL to the logo.
201
   *
202
   * @var string
203
   */
204
  protected $logo;
205
206
  /**
207
   * The URL to the banner.
208
   *
209
   * @var string
210
   */
211
  protected $banner;
212
213
  /**
214
   * The URL to the youtube page.
215
   *
216
   * @var string
217
   */
218
  protected $youtube;
219
220
  /**
221
   * Whether or not the team is locked.
222
   *
223
   * @var string
224
   */
225
  protected $locked;
226
227
  /**
228
   * {@inheritdoc}
229
   */
230 1
  public function getId() {
231 1
    return $this->id;
232
  }
233
234
  /**
235
   * {@inheritdoc}
236
   */
237 1
  public function getName() {
238 1
    return $this->name;
239
  }
240
241
  /**
242
   * {@inheritdoc}
243
   */
244 1
  public function getTeamShort() {
245 1
    return $this->teamShort;
246
  }
247
248
  /**
249
   * {@inheritdoc}
250
   */
251 1
  public function getAlternateName() {
252 1
    return $this->alternateName;
253
  }
254
255
  /**
256
   * {@inheritdoc}
257
   */
258 1
  public function getFormedYear() {
259 1
    return $this->formedYear;
260
  }
261
262
  /**
263
   * {@inheritdoc}
264
   */
265 1
  public function getSport() {
266 1
    return $this->sport;
267
  }
268
269
  /**
270
   * {@inheritdoc}
271
   */
272 1
  public function getLeague() {
273 1
    return $this->league;
274
  }
275
276
  /**
277
   * {@inheritdoc}
278
   */
279 1
  public function getDivision() {
280 1
    return $this->division;
281
  }
282
283
  /**
284
   * {@inheritdoc}
285
   */
286 1
  public function getManager() {
287 1
    return $this->manager;
288
  }
289
290
  /**
291
   * {@inheritdoc}
292
   */
293 1
  public function getStadium() {
294 1
    return $this->stadium;
295
  }
296
297
  /**
298
   * {@inheritdoc}
299
   */
300 1
  public function getKeywords() {
301 1
    return $this->keywords;
302
  }
303
304
  /**
305
   * {@inheritdoc}
306
   */
307 1
  public function getRss() {
308 1
    return $this->rss;
309
  }
310
311
  /**
312
   * {@inheritdoc}
313
   */
314 1
  public function getStadiumThumb() {
315 1
    return $this->stadiumThumb;
316
  }
317
318
  /**
319
   * {@inheritdoc}
320
   */
321 1
  public function getStadiumDescription() {
322 1
    return $this->stadiumDescription;
323
  }
324
325
  /**
326
   * {@inheritdoc}
327
   */
328 1
  public function getStadiumLocation() {
329 1
    return $this->stadiumLocation;
330
  }
331
332
  /**
333
   * {@inheritdoc}
334
   */
335 1
  public function getStadiumCapacity() {
336 1
    return $this->stadiumCapacity;
337
  }
338
339
  /**
340
   * {@inheritdoc}
341
   */
342 1
  public function getWebsite() {
343 1
    return $this->website;
344
  }
345
346
  /**
347
   * {@inheritdoc}
348
   */
349 1
  public function getFacebook() {
350 1
    return $this->facebook;
351
  }
352
353
  /**
354
   * {@inheritdoc}
355
   */
356 1
  public function getTwitter() {
357 1
    return $this->twitter;
358
  }
359
360
  /**
361
   * {@inheritdoc}
362
   */
363 1
  public function getInstagram() {
364 1
    return $this->instagram;
365
  }
366
367
  /**
368
   * {@inheritdoc}
369
   */
370 1
  public function getDescription() {
371 1
    return $this->description;
372
  }
373
374
  /**
375
   * {@inheritdoc}
376
   */
377 1
  public function getGender() {
378 1
    return $this->gender;
379
  }
380
381
  /**
382
   * {@inheritdoc}
383
   */
384 1
  public function getCountry() {
385 1
    return $this->country;
386
  }
387
388
  /**
389
   * {@inheritdoc}
390
   */
391 1
  public function getBadge() {
392 1
    return $this->badge;
393
  }
394
395
  /**
396
   * {@inheritdoc}
397
   */
398 1
  public function getJersey() {
399 1
    return $this->jersey;
400
  }
401
402
  /**
403
   * {@inheritdoc}
404
   */
405 1
  public function getLogo() {
406 1
    return $this->logo;
407
  }
408
409
  /**
410
   * {@inheritdoc}
411
   */
412 1
  public function getBanner() {
413 1
    return $this->banner;
414
  }
415
416
  /**
417
   * {@inheritdoc}
418
   */
419 1
  public function getYoutube() {
420 1
    return $this->youtube;
421
  }
422
423
  /**
424
   * {@inheritdoc}
425
   */
426 1
  public function getLocked() {
427 1
    return $this->locked;
428
  }
429
430
  /**
431
   * Transforms the sport property to a sport entity.
432
   *
433
   * @param mixed $value
434
   *   The source value of the sport property.
435
   * @param \stdClass $context
436
   *   The source object representing this team.
437
   * @param EntityManagerInterface $entityManager
438
   *   The entity manager.
439
   *
440
   * @return \TheSportsDb\Entity\SportInterface
441
   *   The sport entity.
442
   */
443
  public static function transformSport($value, $context, EntityManagerInterface $entityManager) {
444
    return static::transform($value, $context, $entityManager, 'sport', 'strSport');
445
  }
446
447
448
  /**
449
   * Transforms the league property to a league entity.
450
   *
451
   * @param mixed $value
452
   *   The source value of the league property.
453
   * @param \stdClass $context
454
   *   The source object representing this team.
455
   * @param EntityManagerInterface $entityManager
456
   *   The entity manager.
457
   *
458
   * @return \TheSportsDb\Entity\LeagueInterface
459
   *   The league entity.
460
   */
461
  public static function transformLeague($value, $context, EntityManagerInterface $entityManager) {
462
    return static::transform($value, $context, $entityManager, 'league', 'idLeague', array('strLeague' => 'strLeague'));
463
  }
464
465
  /**
466
   * {@inheritdoc}
467
   */
468 1
  protected static function initPropertyMapDefinition() {
469 1
    static::$propertyMapDefinition
470 1
      ->addPropertyMap(
471 1
        new PropertyDefinition('idTeam'),
472 1
        new PropertyDefinition('id')
473
      )
474 1
      ->addPropertyMap(
475 1
        new PropertyDefinition('strTeam'),
476 1
        new PropertyDefinition('name')
477
      )
478 1
      ->addPropertyMap(
479 1
        new PropertyDefinition('strTeamShort'),
480 1
        new PropertyDefinition('teamShort')
481
      )
482 1
      ->addPropertyMap(
483 1
        new PropertyDefinition('strAlternateName'),
484 1
        new PropertyDefinition('alternateName')
485
      )
486 1
      ->addPropertyMap(
487 1
        new PropertyDefinition('strFormedYear'),
488 1
        new PropertyDefinition('formedYear')
489
      )
490 1
      ->addPropertyMap(
491 1
        new PropertyDefinition('strSport'),
492 1
        new PropertyDefinition('sport', 'sport'),
493 1
        [self::class, 'transformSport'],
494 1
        [Sport::class, 'reverse']
495
      )
496 1
      ->addPropertyMap(
497 1
        new PropertyDefinition('idLeague'),
498 1
        new PropertyDefinition('league', 'league'),
499 1
        [self::class, 'transformLeague'],
500 1
        [League::class, 'reverse']
501
      )
502 1
      ->addPropertyMap(
503 1
        new PropertyDefinition('strDivision'),
504 1
        new PropertyDefinition('division')
505
      )
506 1
      ->addPropertyMap(
507 1
        new PropertyDefinition('strManager'),
508 1
        new PropertyDefinition('manager')
509
      )
510 1
      ->addPropertyMap(
511 1
        new PropertyDefinition('strStadium'),
512 1
        new PropertyDefinition('stadium')
513
      )
514 1
      ->addPropertyMap(
515 1
        new PropertyDefinition('strKeywords'),
516 1
        new PropertyDefinition('keywords')
517
      )
518 1
      ->addPropertyMap(
519 1
        new PropertyDefinition('strRSS'),
520 1
        new PropertyDefinition('rss')
521
      )
522 1
      ->addPropertyMap(
523 1
        new PropertyDefinition('strStadiumThumb'),
524 1
        new PropertyDefinition('stadiumThumb')
525
      )
526 1
      ->addPropertyMap(
527 1
        new PropertyDefinition('strStadiumDescription'),
528 1
        new PropertyDefinition('stadiumDescription')
529
      )
530 1
      ->addPropertyMap(
531 1
        new PropertyDefinition('strStadiumLocation'),
532 1
        new PropertyDefinition('stadiumLocation')
533
      )
534 1
      ->addPropertyMap(
535 1
        new PropertyDefinition('intStadiumCapacity'),
536 1
        new PropertyDefinition('stadiumCapacity')
537
      )
538 1
      ->addPropertyMap(
539 1
        new PropertyDefinition('strWebsite'),
540 1
        new PropertyDefinition('website')
541
      )
542 1
      ->addPropertyMap(
543 1
        new PropertyDefinition('strFacebook'),
544 1
        new PropertyDefinition('facebook')
545
      )
546 1
      ->addPropertyMap(
547 1
        new PropertyDefinition('strTwitter'),
548 1
        new PropertyDefinition('twitter')
549
      )
550 1
      ->addPropertyMap(
551 1
        new PropertyDefinition('strInstagram'),
552 1
        new PropertyDefinition('instagram')
553
      )
554 1
      ->addPropertyMap(
555 1
        new PropertyDefinition('strDescriptionEN'),
556 1
        new PropertyDefinition('description')
557
      )
558 1
      ->addPropertyMap(
559 1
        new PropertyDefinition('strGender'),
560 1
        new PropertyDefinition('gender')
561
      )
562 1
      ->addPropertyMap(
563 1
        new PropertyDefinition('strCountry'),
564 1
        new PropertyDefinition('country')
565
      )
566 1
      ->addPropertyMap(
567 1
        new PropertyDefinition('strTeamBadge'),
568 1
        new PropertyDefinition('badge')
569
      )
570 1
      ->addPropertyMap(
571 1
        new PropertyDefinition('strTeamJersey'),
572 1
        new PropertyDefinition('jersey')
573
      )
574 1
      ->addPropertyMap(
575 1
        new PropertyDefinition('strTeamLogo'),
576 1
        new PropertyDefinition('logo')
577
      )
578 1
      ->addPropertyMap(
579 1
        new PropertyDefinition('strTeamBanner'),
580 1
        new PropertyDefinition('banner')
581
      )
582 1
      ->addPropertyMap(
583 1
        new PropertyDefinition('strYoutube'),
584 1
        new PropertyDefinition('youtube')
585
      )
586 1
      ->addPropertyMap(
587 1
        new PropertyDefinition('strLocked'),
588 1
        new PropertyDefinition('locked')
589
      );
590
      // idSoccerXML
591
      // intLoved
592
      // strLeague
593
      // strDescriptionDE
594
      // strDescriptionFR
595
      // strDescriptionCN
596
      // strDescriptionIT
597
      // strDescriptionJP
598
      // strDescriptionRU
599
      // strDescriptionES
600
      // strDescriptionPT
601
      // strDescriptionSE
602
      // strDescriptionNL
603
      // strDescriptionHU
604
      // strDescriptionNO
605
      // strDescriptionIL
606
      // strDescriptionPL
607
      // strTeamFanart1
608
      // strTeamFanart2
609
      // strTeamFanart3
610
      // strTeamFanart4
611 1
  }
612
613
}
614