Code Duplication    Length = 8-16 lines in 3 locations

src/eXpansion/Bundle/WidgetBestCheckpoints/Plugins/BestCheckpoints.php 3 locations

@@ 110-117 (lines=8) @@
107
     * @param Record[] $records
108
     * @param          $position
109
     */
110
    public function onLocalRecordsFirstRecord(Record $record, $records, $position, BaseRecords $baseRecords)
111
    {
112
        if (!$this->checkRecordPlugin($baseRecords)) {
113
            return;
114
        }
115
116
        $this->updater->setLocalRecord($record->getPlayer()->getNickname(), $record->getCheckpoints());
117
    }
118
119
    /**
120
     * Called when a player finishes map and does same time as before.
@@ 140-155 (lines=16) @@
137
     * @param int      $position
138
     * @param int      $oldPosition
139
     */
140
    public function onLocalRecordsBetterPosition(
141
        Record $record,
142
        Record $oldRecord,
143
        $records,
144
        $position,
145
        $oldPosition,
146
        BaseRecords $baseRecords
147
    ) {
148
        if (!$this->checkRecordPlugin($baseRecords)) {
149
            return;
150
        }
151
152
        if ($position == 1) {
153
            $this->updater->setLocalRecord($record->getPlayer()->getNickname(), $record->getCheckpoints());
154
        }
155
    }
156
157
    /**
158
     * Called when a player finishes map with better time but keeps same position.
@@ 165-179 (lines=15) @@
162
     * @param Record[] $records
163
     * @param          $position
164
     */
165
    public function onLocalRecordsSamePosition(
166
        Record $record,
167
        Record $oldRecord,
168
        $records,
169
        $position,
170
        BaseRecords $baseRecords
171
    ) {
172
        if (!$this->checkRecordPlugin($baseRecords)) {
173
            return;
174
        }
175
176
        if ($position == 1) {
177
            $this->updater->setLocalRecord($record->getPlayer()->getNickname(), $record->getCheckpoints());
178
        }
179
    }
180
181
    /**
182
     * Check if we can use the data for this plugin.