Code Duplication    Length = 7-8 lines in 3 locations

src/security/x509/_X509Certificate.php 1 location

@@ 78-85 (lines=8) @@
75
    /**
76
     * @return string
77
     */
78
    public function getPublicKey()
79
    {
80
        $pem = (string)$this->file->getPublicKey();
81
        $pem = preg_replace('/\-+BEGIN PUBLIC KEY\-+/','',$pem);
82
        $pem = preg_replace('/\-+END PUBLIC KEY\-+/','',$pem);
83
        $pem = str_replace( array("\n","\r","\t"), '', trim($pem));
84
        return $pem;
85
    }
86
87
    /**
88
     * @return array

src/security/rsa/_RSAPrivateKeyPEMFormat.php 1 location

@@ 72-78 (lines=7) @@
69
    /**
70
     * @return string
71
     */
72
    public function getStrippedEncoded(): string
73
    {
74
        $pem = preg_replace('/\-+BEGIN RSA PRIVATE KEY\-+/','',$this->getEncoded());
75
        $pem = preg_replace('/\-+END RSA PRIVATE KEY\-+/','',$pem);
76
        $pem = str_replace( array("\n","\r","\t"), '', trim($pem));
77
        return $pem;
78
    }
79
80
}

src/security/rsa/_RSAPublicKeyPEMFormat.php 1 location

@@ 84-90 (lines=7) @@
81
    /**
82
     * @return string
83
     */
84
    public function getStrippedEncoded(): string
85
    {
86
        $pem = preg_replace('/\-+BEGIN PUBLIC KEY\-+/','', $this->getEncoded());
87
        $pem = preg_replace('/\-+END PUBLIC KEY\-+/','',$pem);
88
        $pem = str_replace( array("\n","\r","\t"), '', trim($pem));
89
        return $pem;
90
    }
91
}