Code Duplication    Length = 5-6 lines in 2 locations

src/KeyPic/KeyPic.php 2 locations

@@ 229-234 (lines=6) @@
226
            );
227
            $response = $this->sendRequest($fields);
228
229
            if ($response['status'] == 'new_token') {
230
                $this->Token = $response['Token'];
231
                return $response['Token'];
232
            } elseif ($response['status'] == 'error') {
233
                throw new \Exception("Keypic error generation, ".$response['error']);
234
            }
235
        }
236
237
        $this->Token = false;
@@ 331-335 (lines=5) @@
328
329
            $response = $this->sendRequest($fields);
330
331
            if ($response['status'] == 'response') {
332
                return $response['spam'];
333
            } elseif ($response['status'] == 'error') {
334
                throw new \Exception("Error validating keypic token, error: ".$response['error']);
335
            }
336
        } else {
337
            throw new \Exception("Empty keypic token or Form ID");
338
        }