Code Duplication    Length = 25-26 lines in 2 locations

app/library/Classes/Statistics/LeagueStatisticsEloquent.php 2 locations

@@ 94-118 (lines=25) @@
91
        array_multisort($skinsCount, SORT_DESC);
92
        return $skinsCount;
93
    }
94
    public function totalEagles($year){
95
		$date1 = $year . '-01-01';
96
		$date2 = $year . '-12-31';
97
		$holescores = Holescore::with('round.player','hole')
98
			->where('created_at', '>=', $date1)
99
			->where('created_at', '<=', $date2)
100
			->get();
101
		$allEagles = array();
102
		foreach($holescores as $key => $holescore) {
103
			if($holescore['round']['match_id'] != null){
104
				if( ($holescore['hole']['par'] - $holescore['score']) === 2) {
105
					$allEagles[]= $holescore['round']['player']['name'];
106
				}
107
			}
108
		}
109
		$i =0;
110
		$newArray = array_count_values($allEagles);
111
		$eagles = array();
112
		foreach ($newArray as $key => $value) {
113
			$eagles[$i]['name'] = $key;
114
			$eagles[$i]['eagles'] =$value;
115
			$i++;
116
		}
117
		return $eagles;
118
	}
119
    public function totalBirdies($year)
120
	{
121
		$date1 = $year . '-01-01';
@@ 119-144 (lines=26) @@
116
		}
117
		return $eagles;
118
	}
119
    public function totalBirdies($year)
120
	{
121
		$date1 = $year . '-01-01';
122
		$date2 = $year . '-12-31';
123
		$holescores = Holescore::with('round.player','hole')
124
			->where('created_at', '>=', $date1)
125
			->where('created_at', '<=', $date2)
126
			->get();
127
		$allBirdies = array();
128
		foreach($holescores as $key => $holescore) {
129
			if($holescore['round']['match_id'] != null){
130
				if( ($holescore['hole']['par'] - $holescore['score']) === 1) {
131
						$allBirdies[]= $holescore['round']['player']['name'];
132
				}
133
			}
134
		}
135
		$i =0;
136
		$newArray = array_count_values($allBirdies);
137
			$birds = array();
138
			foreach ($newArray as $key => $value) {
139
				$birds[$i]['name'] = $key;
140
				$birds[$i]['birds'] =$value;
141
				$i++;
142
			}
143
			return $birds;
144
	}
145
    public function totalPars($year)
146
	{
147
		$year = $year . '-01-01';