Code Duplication    Length = 7-7 lines in 2 locations

migrations/20170809011200_player_elo_calculations.php 1 location

@@ 146-152 (lines=7) @@
143
    private static function calculateEloDiff($a_elo, $b_elo, $a_points, $b_points, $duration)
144
    {
145
        $prob = 1.0 / (1 + pow(10, (($b_elo - $a_elo) / 400.0)));
146
        if ($a_points > $b_points) {
147
            $diff = 50 * (1 - $prob);
148
        } elseif ($a_points == $b_points) {
149
            $diff = 50 * (0.5 - $prob);
150
        } else {
151
            $diff = 50 * (0 - $prob);
152
        }
153
154
        // Apply ELO modifiers from `config.yml`
155
        $durations = [

models/Match.php 1 location

@@ 1185-1191 (lines=7) @@
1182
    public static function calculateEloDiff($a_elo, $b_elo, $a_points, $b_points, $duration)
1183
    {
1184
        $prob = 1.0 / (1 + pow(10, (($b_elo - $a_elo) / 400.0)));
1185
        if ($a_points > $b_points) {
1186
            $diff = 50 * (1 - $prob);
1187
        } elseif ($a_points == $b_points) {
1188
            $diff = 50 * (0.5 - $prob);
1189
        } else {
1190
            $diff = 50 * (0 - $prob);
1191
        }
1192
1193
        // Apply ELO modifiers from `config.yml`
1194
        $durations = Service::getParameter('bzion.league.duration');