Code Duplication    Length = 14-17 lines in 2 locations

models/Match.php 2 locations

@@ 262-278 (lines=17) @@
259
     *
260
     * @return int The score that team received
261
     */
262
    public function getScore($teamID)
263
    {
264
        if ($teamID instanceof TeamInterface) {
265
            // Oh no! The caller gave us a Team model instead of an ID!
266
            $teamID = $teamID->getId();
267
        } elseif (is_string($teamID)) {
268
            // Make sure we're comparing lowercase strings
269
            $teamID = strtolower($teamID);
270
        }
271
272
        if ($this->getTeamA()->getId() == $teamID) {
273
            return $this->getTeamAPoints();
274
        }
275
276
        return $this->getTeamBPoints();
277
    }
278
279
    /**
280
     * Get the score of the opponent relative to a team
281
     *
@@ 298-311 (lines=14) @@
295
     *
296
     * @return TeamInterface The opponent team
297
     */
298
    public function getOpponent($teamID)
299
    {
300
        if ($teamID instanceof TeamInterface) {
301
            $teamID = $teamID->getId();
302
        } elseif (is_string($teamID)) {
303
            $teamID = strtolower($teamID);
304
        }
305
306
        if ($this->getTeamA()->getId() == $teamID) {
307
            return $this->getTeamB();
308
        }
309
310
        return $this->getTeamA();
311
    }
312
313
    /**
314
     * Get the timestamp of the last update of the match