Code Duplication    Length = 14-17 lines in 2 locations

models/Match.php 2 locations

@@ 225-241 (lines=17) @@
222
     *
223
     * @return int The score that team received
224
     */
225
    public function getScore($teamID)
226
    {
227
        if ($teamID instanceof TeamInterface) {
228
            // Oh no! The caller gave us a Team model instead of an ID!
229
            $teamID = $teamID->getId();
230
        } elseif (is_string($teamID)) {
231
            // Make sure we're comparing lowercase strings
232
            $teamID = strtolower($teamID);
233
        }
234
235
236
        if ($this->getTeamA()->getId() == $teamID) {
237
            return $this->getTeamAPoints();
238
        }
239
240
        return $this->getTeamBPoints();
241
    }
242
243
    /**
244
     * Get the score of the opponent relative to a team
@@ 262-275 (lines=14) @@
259
     *
260
     * @return TeamInterface The opponent team
261
     */
262
    public function getOpponent($teamID)
263
    {
264
        if ($teamID instanceof TeamInterface) {
265
            $teamID = $teamID->getId();
266
        } elseif (is_string($teamID)) {
267
            $teamID = strtolower($teamID);
268
        }
269
270
        if ($this->getTeamA()->getId() == $teamID) {
271
            return $this->getTeamB();
272
        }
273
274
        return $this->getTeamA();
275
    }
276
277
    /**
278
     * Get the timestamp of the last update of the match