Code Duplication    Length = 9-10 lines in 2 locations

app/SlashCommandHandlers/Jobs/ShowTDTicketJob.php 1 location

@@ 21-29 (lines=9) @@
18
        $userSession = new SessionManager();
19
        $TDinstance = $userSession->setupSession($this->request->userId, $this->request->token);
20
21
        if ($TDinstance->checkToken()) {
22
            Log::info('CP_ShowTDTicketJob: There is a token.');
23
            $auth = true;
24
            $ticket = $TDinstance->ticket($this->request->text);
25
        } else {
26
            Log::info('CP_ShowTDTicketJob: No token.');
27
            $auth = false;
28
            $ticket = null;
29
        }
30
31
        if ($ticket && $auth) {
32
            $date = date('F jS, Y', strtotime($ticket['CreatedDate']));

app/SlashCommandHandlers/Jobs/SearchTDTicketJob.php 1 location

@@ 22-31 (lines=10) @@
19
        $userSession = new SessionManager();
20
        $TDinstance = $userSession->setupSession($this->request->userId, $this->request->token);
21
22
        if ($TDinstance->checkToken()) {
23
            Log::info('CP_SearchTDTicketJob: There is a token.');
24
            $auth = true;
25
            $tickets = $TDinstance->searchTicketsName($this->request->text);
26
            $userSession()->increment('td_searches');
27
        } else {
28
            Log::info('CP_SearchTDTicketJob: No token.');
29
            $auth = false;
30
            $tickets = null;
31
        }
32
33
        $opencount = 0;
34
        if (!count($tickets) && $auth) {