Code Duplication    Length = 12-13 lines in 2 locations

models/Match.php 2 locations

@@ 235-247 (lines=13) @@
232
     *
233
     * @return int The score that team received
234
     */
235
    public function getScore($teamID)
236
    {
237
        if ($teamID instanceof Team) {
238
            // Oh no! The caller gave us a Team model instead of an ID!
239
            $teamID = $teamID->getId();
240
        }
241
242
        if ($this->getTeamA()->getId() == $teamID) {
243
            return $this->getTeamAPoints();
244
        }
245
246
        return $this->getTeamBPoints();
247
    }
248
249
    /**
250
     * Get the score of the opponent relative to a team
@@ 256-267 (lines=12) @@
253
     *
254
     * @return int The score of the opponent
255
     */
256
    public function getOpponentScore($teamID)
257
    {
258
        if ($teamID instanceof Team) {
259
            $teamID = $teamID->getId();
260
        }
261
262
        if ($this->getTeamA()->getId() != $teamID) {
263
            return $this->getTeamAPoints();
264
        }
265
266
        return $this->getTeamBPoints();
267
    }
268
269
    /**
270
     * Get the opponent of a match relative to a team ID