| @@ 251-267 (lines=17) @@ | ||
| 248 | * |
|
| 249 | * @return int The score that team received |
|
| 250 | */ |
|
| 251 | public function getScore($teamID) |
|
| 252 | { |
|
| 253 | if ($teamID instanceof TeamInterface) { |
|
| 254 | // Oh no! The caller gave us a Team model instead of an ID! |
|
| 255 | $teamID = $teamID->getId(); |
|
| 256 | } elseif (is_string($teamID)) { |
|
| 257 | // Make sure we're comparing lowercase strings |
|
| 258 | $teamID = strtolower($teamID); |
|
| 259 | } |
|
| 260 | ||
| 261 | if ($this->getTeamA()->getId() == $teamID) { |
|
| 262 | return $this->getTeamAPoints(); |
|
| 263 | } |
|
| 264 | ||
| 265 | return $this->getTeamBPoints(); |
|
| 266 | } |
|
| 267 | ||
| 268 | /** |
|
| 269 | * Get the score of the opponent relative to a team |
|
| 270 | * |
|
| @@ 287-300 (lines=14) @@ | ||
| 284 | * |
|
| 285 | * @return TeamInterface The opponent team |
|
| 286 | */ |
|
| 287 | public function getOpponent($teamID) |
|
| 288 | { |
|
| 289 | if ($teamID instanceof TeamInterface) { |
|
| 290 | $teamID = $teamID->getId(); |
|
| 291 | } elseif (is_string($teamID)) { |
|
| 292 | $teamID = strtolower($teamID); |
|
| 293 | } |
|
| 294 | ||
| 295 | if ($this->getTeamA()->getId() == $teamID) { |
|
| 296 | return $this->getTeamB(); |
|
| 297 | } |
|
| 298 | ||
| 299 | return $this->getTeamA(); |
|
| 300 | } |
|
| 301 | ||
| 302 | /** |
|
| 303 | * Get the timestamp of the last update of the match |
|