Code Duplication    Length = 14-17 lines in 2 locations

models/Match.php 2 locations

@@ 235-251 (lines=17) @@
232
     *
233
     * @return int The score that team received
234
     */
235
    public function getScore($teamID)
236
    {
237
        if ($teamID instanceof TeamInterface) {
238
            // Oh no! The caller gave us a Team model instead of an ID!
239
            $teamID = $teamID->getId();
240
        } elseif (is_string($teamID)) {
241
            // Make sure we're comparing lowercase strings
242
            $teamID = strtolower($teamID);
243
        }
244
245
246
        if ($this->getTeamA()->getId() == $teamID) {
247
            return $this->getTeamAPoints();
248
        }
249
250
        return $this->getTeamBPoints();
251
    }
252
253
    /**
254
     * Get the score of the opponent relative to a team
@@ 272-285 (lines=14) @@
269
     *
270
     * @return TeamInterface The opponent team
271
     */
272
    public function getOpponent($teamID)
273
    {
274
        if ($teamID instanceof TeamInterface) {
275
            $teamID = $teamID->getId();
276
        } elseif (is_string($teamID)) {
277
            $teamID = strtolower($teamID);
278
        }
279
280
        if ($this->getTeamA()->getId() == $teamID) {
281
            return $this->getTeamB();
282
        }
283
284
        return $this->getTeamA();
285
    }
286
287
    /**
288
     * Get the timestamp of the last update of the match