Code Duplication    Length = 11-11 lines in 2 locations

src/Wallet.php 1 location

@@ 368-378 (lines=11) @@
365
     * @return BIP32Key
366
     * @throws \Exception
367
     */
368
    public function getBlocktrailPublicKey($path) {
369
        $path = BIP32Path::path($path);
370
371
        $keyIndex = str_replace("'", "", $path[1]);
372
373
        if (!isset($this->blocktrailPublicKeys[$keyIndex])) {
374
            throw new \Exception("No blocktrail publickey for key index [{$keyIndex}]");
375
        }
376
377
        return $this->blocktrailPublicKeys[$keyIndex];
378
    }
379
380
    /**
381
     * generate a new derived key and return the new path and address for it

src/WalletSweeper.php 1 location

@@ 204-214 (lines=11) @@
201
     * @return BIP32Key
202
     * @throws \Exception
203
     */
204
    protected function getBlocktrailPublicKey($path) {
205
        $path = BIP32Path::path($path);
206
207
        $keyIndex = str_replace("'", "", $path[1]);
208
209
        if (!isset($this->blocktrailPublicKeys[$keyIndex])) {
210
            throw new \Exception("No blocktrail publickey for key index [{$keyIndex}]");
211
        }
212
213
        return $this->blocktrailPublicKeys[$keyIndex];
214
    }
215
216
    /**
217
     * discover funds in the wallet