Lcobucci\JWT\Signer\Ecdsa\KeyParser::getKeyContent PHP Метод

getKeyContent() приватный Метод

Extracts the base 64 value from the PEM certificate
private getKeyContent ( Lcobucci\JWT\Signer\Key $key, string $header ) : string
$key Lcobucci\JWT\Signer\Key
$header string
Результат string
    private function getKeyContent(Key $key, string $header) : string
    {
        $match = null;
        preg_match('/[\\-]{5}BEGIN ' . $header . '[\\-]{5}(.*)[\\-]{5}END ' . $header . '[\\-]{5}/', str_replace([PHP_EOL, "\n", "\r"], '', $key->getContent()), $match);
        if (count($match) === 2) {
            return $match[1];
        }
        throw new InvalidArgumentException('This is not a valid ECDSA key.');
    }