| 1 | <?php |
||
| 13 | class ColorTeam implements TeamInterface |
||
| 14 | { |
||
| 15 | /** |
||
| 16 | * The color of the team |
||
| 17 | * |
||
| 18 | * @var string |
||
| 19 | */ |
||
| 20 | protected $color; |
||
| 21 | |||
| 22 | /** |
||
| 23 | * Define a new ColorTeam |
||
| 24 | * @param string $color The color of the team |
||
| 25 | */ |
||
| 26 | 1 | public function __construct($color) |
|
| 27 | { |
||
| 28 | 1 | $this->color = strtolower($color); |
|
| 29 | 1 | } |
|
| 30 | |||
| 31 | /** |
||
| 32 | * Get a unique identifier for the team |
||
| 33 | * |
||
| 34 | * @return string |
||
| 35 | */ |
||
| 36 | 1 | public function getId() |
|
| 37 | { |
||
| 38 | 1 | return $this->color; |
|
| 39 | } |
||
| 40 | |||
| 41 | /** |
||
| 42 | * {@inheritdoc} |
||
| 43 | */ |
||
| 44 | 1 | public function getName() |
|
| 45 | { |
||
| 46 | 1 | return ucwords($this->color) . " Team"; |
|
| 47 | } |
||
| 48 | |||
| 49 | /** |
||
| 50 | * {@inheritdoc} |
||
| 51 | */ |
||
| 52 | 1 | public function getAvatar() |
|
| 53 | { |
||
| 54 | 1 | return "assets/imgs/team_" . $this->color . ".png"; |
|
| 55 | } |
||
| 56 | |||
| 57 | /** |
||
| 58 | * Return whether a team color is valid |
||
| 59 | * |
||
| 60 | * @param string $color The color to check |
||
| 61 | */ |
||
| 62 | 1 | public static function isValidTeamColor($color) |
|
| 66 | |||
| 67 | /** |
||
| 68 | * Find out if a team is the same as another team |
||
| 69 | * |
||
| 70 | * @param mixed $team The team to compare |
||
| 71 | * @param bool |
||
| 72 | */ |
||
| 73 | 1 | public function isSameAs($team) |
|
| 79 | } |
||
| 80 |