Code Duplication    Length = 18-18 lines in 2 locations

app/Api/Controllers/Presence/TimelogController.php 2 locations

@@ 209-226 (lines=18) @@
206
     * @author Harlequin Doyon <[email protected]>
207
     * @author Bertrand Kintanar <[email protected]>
208
     */
209
    public function attemptTimeIn()
210
    {
211
        $note = '';
212
213
        if (!$this->timelog->hasNoLatestTimein($this->loggedEmployee())) {
214
            $note = "You have an active timelog that doesn't have a time out yet";
215
        }
216
217
        $data = [
218
            'title'              => 'Are you sure?',
219
            'html'               => $this->html('You want to time in!', $note),
220
            'showCancelButton'   => true,
221
            'confirmButtonColor' => '#DD6B55',
222
            'closeOnConfirm'     => false,
223
        ];
224
225
        return $this->responseAPI(200, SUCCESS_RETRIEVE_MESSAGE, $data);
226
    }
227
228
    /**
229
     * Alert HTML helper.
@@ 261-278 (lines=18) @@
258
     * @author Harlequin Doyon <[email protected]>
259
     * @author Bertrand Kintanar <[email protected]>
260
     */
261
    public function attemptTimeOut()
262
    {
263
        $note = '';
264
265
        if (!$this->timelog->hasNoLatestTimeout($this->loggedEmployee())) {
266
            $note = "You don't have an active time in log";
267
        }
268
269
        $data = [
270
            'title'              => 'Are you sure?',
271
            'html'               => $this->html('You want to time out!', $note),
272
            'showCancelButton'   => true,
273
            'confirmButtonColor' => '#DD6B55',
274
            'closeOnConfirm'     => false,
275
        ];
276
277
        return $this->responseAPI(200, SUCCESS_RETRIEVE_MESSAGE, $data);
278
    }
279
280
    /**
281
     * Save time in log in the database.