private function getKeyContent(Key $key, $header)
    {
        $match = null;

        preg_match(
            '/^[\-]{5}BEGIN ' . $header . '[\-]{5}(.*)[\-]{5}END ' . $header . '[\-]{5}$/',
            str_replace([PHP_EOL, "\n", "\r"], '', $key->getContent()),
            $match
        );

        if (isset($match[1])) {
            return $match[1];
        }

        throw new \InvalidArgumentException('This is not a valid ECDSA key.');
    }
private function getKeyContent(Key $key, $header)
    {
        $match = null;

        preg_match(
            '/^[\-]{5}BEGIN ' . $header . '[\-]{5}(.*)[\-]{5}END ' . $header . '[\-]{5}$/',
            str_replace([PHP_EOL, "\n", "\r"], '', $key->getContent()),
            $match
        );

        if (isset($match[1])) {
            return $match[1];
        }

        throw new \InvalidArgumentException('This is not a valid ECDSA key.');
    }
private function getKeyContent ( Key $ key , $ header ) { $ match = null ; preg_match ( '/^[\-]{5}BEGIN ' . $ header . '[\-]{5}(.*)[\-]{5}END ' . $ header . '[\-]{5}$/' , str_replace ( [ PHP_EOL , "\n" , "\r" ] , '' , $ key -> getContent ( ) ) , $ match ) ; if ( isset ( $ match [ 1 ] ) ) { return $ match [ 1 ] ; } throw new \ InvalidArgumentException ( 'This is not a valid ECDSA key.' ) ; }
Extracts the base 64 value from the PEM certificate

@param Key $key
@param string $header

@return string

@throws \InvalidArgumentException When given key is not a ECDSA key
Extracts the base 64 value from the PEM certificate