Code Duplication    Length = 15-15 lines in 2 locations

src/Event.php 2 locations

@@ 176-190 (lines=15) @@
173
	 *
174
	 * @return float|int Time in seconds
175
	 */
176
	public function getMaxDuration() {
177
		if (empty($this->stopped_laps)) {
178
			return 0;
179
		}
180
181
		$duration = 0;
182
183
		foreach ($this->stopped_laps as $lap) {
184
			if (($lap_duration = $lap->getDuration()) > $duration) {
185
				$duration = $lap_duration;
186
			}
187
		}
188
189
		return $duration;
190
	}
191
192
	/**
193
	 * Returns the average duration of all laps
@@ 197-211 (lines=15) @@
194
	 *
195
	 * @return float|int Time in seconds
196
	 */
197
	public function getAverageDuration() {
198
		if (empty($this->stopped_laps)) {
199
			return 0;
200
		}
201
202
		$duration = 0;
203
		$count = 0;
204
205
		foreach ($this->stopped_laps as $lap) {
206
			$duration += $lap->getDuration();
207
			$count++;
208
		}
209
210
		return $duration / $count;
211
	}
212
}
213