Code Duplication    Length = 17-17 lines in 2 locations

src/Request.php 1 location

@@ 192-208 (lines=17) @@
189
     *      @throws Exception\Runtime
190
     *      @return string
191
     */
192
    protected function own_private_key()
193
    {
194
        // check private key file
195
        if ( ! file_exists($this->jwt['our_privkey']))
196
        {
197
            throw new Exception\Runtime('The file with the private key was not find!');
198
        }
199
200
        // load private key file
201
        $private_key = $this->file_get_contents($this->jwt['our_privkey']);
202
        if ($private_key === FALSE)
203
        {
204
            throw new Exception\Runtime('The file with the private key was not read!');
205
        }
206
207
        return $private_key;
208
    }
209
210
    /**
211
     *      Encode payload and return token

src/Response.php 1 location

@@ 120-136 (lines=17) @@
117
     *      @throws Exception\Runtime
118
     *      @return string Public key
119
     */
120
    protected function uapay_public_key()
121
    {
122
        // check public key file
123
        if ( ! file_exists($this->jwt['UAPAY_pubkey']))
124
        {
125
            throw new Exception\Runtime('The file with the public key was not find!');
126
        }
127
128
        // load public key file
129
        $public_key = $this->file_get_contents($this->jwt['UAPAY_pubkey']);
130
        if ($public_key === FALSE)
131
        {
132
            throw new Exception\Runtime('The file with the public key was not read!');
133
        }
134
135
        return $public_key;
136
    }
137
138
    /**
139
     *      Decode token