Code Duplication    Length = 12-15 lines in 2 locations

src/Client/Abstracts/AbstractClient.php 2 locations

@@ 197-208 (lines=12) @@
194
     * @inheritdoc
195
     * @throws AuthenticationException - When Login request fails
196
     */
197
    public function login() {
198
        $EP = new OAuth2Token($this->apiURL);
199
        $response = $EP->execute($this->credentials)->getResponse();
200
        if ($response->getStatus()=='200'){
201
            $this->setToken($response->getBody(FALSE));
202
            static::storeToken($this->token,$this->credentials['client_id']);
203
        } else {
204
            $error = $response->getBody();
205
            throw new AuthenticationException("Login Response [".$error['error']."] ".$error['error_message']);
206
        }
207
        return TRUE;
208
    }
209
210
    /**
211
     * @inheritdoc
@@ 241-255 (lines=15) @@
238
     * @inheritdoc
239
     * @throws AuthenticationException - When logout request fails
240
     */
241
    public function logout(){
242
        if ($this->authenticated()){
243
            $EP = new OAuth2Logout($this->apiURL);
244
            $response = $EP->execute()->getResponse();
245
            if ($response->getStatus()=='200'){
246
                unset($this->token);
247
                static::removeStoredToken($this->credentials['client_id']);
248
                return TRUE;
249
            }else{
250
                $error = $response->getBody();
251
                throw new AuthenticationException("Logout Response [".$error['error']."] ".$error['message']);
252
            }
253
        }
254
        return FALSE;
255
    }
256
257
    /**
258
     * @inheritdoc