Code Duplication    Length = 18-18 lines in 2 locations

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

@@ 223-240 (lines=18) @@
220
     * @author Harlequin Doyon <[email protected]>
221
     * @author Bertrand Kintanar <[email protected]>
222
     */
223
    public function attemptTimeIn()
224
    {
225
        $note = '';
226
227
        if (!$this->timelog->hasNoLatestTimein($this->loggedEmployee())) {
228
            $note = "You have an active timelog that doesn't have a time out yet";
229
        }
230
231
        $data = [
232
            'title'              => 'Are you sure?',
233
            'html'               => $this->html('You want to time in!', $note),
234
            'showCancelButton'   => true,
235
            'confirmButtonColor' => '#DD6B55',
236
            'closeOnConfirm'     => false,
237
        ];
238
239
        return $this->responseAPI(Response::HTTP_OK, SUCCESS_RETRIEVE_MESSAGE, $data);
240
    }
241
242
    /**
243
     * Alert HTML helper.
@@ 275-292 (lines=18) @@
272
     * @author Harlequin Doyon <[email protected]>
273
     * @author Bertrand Kintanar <[email protected]>
274
     */
275
    public function attemptTimeOut()
276
    {
277
        $note = '';
278
279
        if (!$this->timelog->hasNoLatestTimeout($this->loggedEmployee())) {
280
            $note = "You don't have an active time in log";
281
        }
282
283
        $data = [
284
            'title'              => 'Are you sure?',
285
            'html'               => $this->html('You want to time out!', $note),
286
            'showCancelButton'   => true,
287
            'confirmButtonColor' => '#DD6B55',
288
            'closeOnConfirm'     => false,
289
        ];
290
291
        return $this->responseAPI(Response::HTTP_OK, SUCCESS_RETRIEVE_MESSAGE, $data);
292
    }
293
294
    /**
295
     * Save time in log in the database.