Code Duplication    Length = 22-22 lines in 2 locations

api/Lib/DsManager/Helpers/MatchSimulator.php 2 locations

@@ 35-56 (lines=22) @@
32
     * @param $matchId
33
     * @return mixed
34
     */
35
    public static function simulateCompleteResult($matchId)
36
    {
37
        $result = MatchResult::complete()->where(
38
            [
39
                'id' => $matchId
40
            ]
41
        )->first();
42
43
        if (!empty($result)
44
            && !$result->simulated
45
            && self::simulate($matchId) === 1
46
        ) {
47
            $result = MatchResult::complete()
48
                ->where(
49
                    [
50
                        'id' => $matchId
51
                    ]
52
                )->first();
53
        }
54
55
        return $result;
56
    }
57
58
    public
59
    static function simulateSimpleResult($matchId)
@@ 58-79 (lines=22) @@
55
        return $result;
56
    }
57
58
    public
59
    static function simulateSimpleResult($matchId)
60
    {
61
        $result = MatchResult::teams()->where(
62
            [
63
                'id' => $matchId
64
            ]
65
        )->first();
66
67
        if (!empty($result)
68
            && !$result->simulated
69
            && self::simulate($matchId) === 1
70
        ) {
71
            $result = MatchResult::teams()
72
                ->where(
73
                    [
74
                        'id' => $matchId
75
                    ]
76
                )->first();
77
        }
78
        return $result;
79
    }
80
81
    private
82
    static function simulate($matchId)