Added code coverage ignore docblocks

This commit is contained in:
Alex Bilbie 2016-02-12 18:08:27 +00:00
parent de13e14cdd
commit 335630f150
2 changed files with 6 additions and 0 deletions

View File

@ -36,7 +36,9 @@ class KeyCrypt
$chunk = substr($unencryptedData, 0, $chunkSize);
$unencryptedData = substr($unencryptedData, $chunkSize);
if (openssl_private_encrypt($chunk, $encrypted, $privateKey) === false) {
// @codeCoverageIgnoreStart
throw new \LogicException('Failed to encrypt data');
// @codeCoverageIgnoreEnd
}
$output .= $encrypted;
}
@ -72,7 +74,9 @@ class KeyCrypt
$chunk = substr($encryptedData, 0, $chunkSize);
$encryptedData = substr($encryptedData, $chunkSize);
if (openssl_public_decrypt($chunk, $decrypted, $publicKey) === false) {
// @codeCoverageIgnoreStart
throw new \LogicException('Failed to decrypt data');
// @codeCoverageIgnoreEnd
}
$output .= $decrypted;
}

View File

@ -31,6 +31,7 @@ class SecureKey
{
try {
$string = random_bytes($len);
// @codeCoverageIgnoreStart
} catch (\TypeError $e) {
// Well, it's an integer, so this IS unexpected.
throw OAuthServerException::serverError("An unexpected error has occurred");
@ -41,6 +42,7 @@ class SecureKey
// If you get this message, the CSPRNG failed hard.
throw OAuthServerException::serverError("Could not generate a random string. Is our OS secure?");
}
// @codeCoverageIgnoreEnd
return bin2hex($string);
}