Code Duplication    Length = 17-17 lines in 2 locations

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

src/Request.php 1 location

@@ 170-186 (lines=17) @@
167
     *      @throws Exception\Runtime
168
     *      @return string
169
     */
170
    protected function own_private_key()
171
    {
172
        // check private key file
173
        if ( ! file_exists($this->jwt['our_privkey']))
174
        {
175
            throw new Exception\Runtime('The file with the private key was not find!');
176
        }
177
178
        // load private key file
179
        $private_key = $this->file_get_contents($this->jwt['our_privkey']);
180
        if ($private_key === FALSE)
181
        {
182
            throw new Exception\Runtime('The file with the private key was not read!');
183
        }
184
185
        return $private_key;
186
    }
187
188
    /**
189
     *      Encode payload and return token