Code Duplication    Length = 10-11 lines in 2 locations

app/CP_TDinstance.php 2 locations

@@ 53-62 (lines=10) @@
50
        $this->appid = $appid;
51
52
        $parts = explode('.', $auth);
53
        if (count($parts) == 3) {
54
            list($JWTheader, $JWTpayload, $JWTsig) = $parts;
55
            $this->auth = $auth;
56
            $this->expires = json_decode(base64_decode($JWTpayload))->exp;
57
            $this->authstring = 'Authorization: Bearer '.$this->auth;
58
            $this->header = $JWTheader;
59
            $this->authsig = $JWTsig;
60
61
            return;
62
        }
63
        Log::info('CP_TDauth: Invalid token.');
64
    }
65
@@ 90-100 (lines=11) @@
87
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
88
        $bearer = curl_exec($ch);
89
        curl_close($ch);
90
        if (!$bearer) {
91
            Log::info('CP_TDauth: Authorization failed.');
92
        } else {
93
            Log::info('CP_TDauth: Authorization successful.');
94
            list($JWTheader, $JWTpayload, $JWTsig) = explode('.', $bearer);
95
            $this->auth = $bearer;
96
            $this->expires = json_decode(base64_decode($JWTpayload))->exp;
97
            $this->authstring = 'Authorization: Bearer '.$this->auth;
98
            $this->header = $JWTheader;
99
            $this->authsig = $JWTsig;
100
        }
101
    }
102
103
    public function checkToken()