Code Duplication    Length = 11-12 lines in 2 locations

src/KeyManager.php 2 locations

@@ 45-55 (lines=11) @@
42
     * @param int $client_id
43
     * @return \Illuminate\Http\JsonResponse
44
     */
45
    public function getPrivateKey(int $client_id): JsonResponse
46
    {
47
        $client = Client::with('apiCredential')->where('id', $client_id)->first();
48
49
        if (! $client) {
50
51
            return $this->error("No client found with id $client_id");
52
        }
53
54
        return $this->success('Key retrieved successfully', ['key' => $client->apiCredential->private_key]);
55
    }
56
57
    /**
58
     * Change Client's public and private keys.
@@ 63-74 (lines=12) @@
60
     * @param int $client_id
61
     * @return \Illuminate\Http\JsonResponse
62
     */
63
    public function changeKeys(int $client_id): JsonResponse
64
    {
65
        $key = ApiCredential::where('key_client_id', $client_id)->first();
66
67
        if (! $key) {
68
            return $this->error('Client information not found');
69
        }
70
71
        $key->update(ApiCredential::generateKeyPairArray());
72
73
        return $this->success('Api Keys successfully changed', ['key' => $key->private_key]);
74
    }
75
76
    /**
77
     * Suspend Client's Account.