From 335630f150f87b43e562484daf36c3510041038a Mon Sep 17 00:00:00 2001 From: Alex Bilbie Date: Fri, 12 Feb 2016 18:08:27 +0000 Subject: [PATCH] Added code coverage ignore docblocks --- src/Utils/KeyCrypt.php | 4 ++++ src/Utils/SecureKey.php | 2 ++ 2 files changed, 6 insertions(+) diff --git a/src/Utils/KeyCrypt.php b/src/Utils/KeyCrypt.php index 634cd80b..8b62c10a 100644 --- a/src/Utils/KeyCrypt.php +++ b/src/Utils/KeyCrypt.php @@ -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; } diff --git a/src/Utils/SecureKey.php b/src/Utils/SecureKey.php index f5078bbf..ee5a85ea 100644 --- a/src/Utils/SecureKey.php +++ b/src/Utils/SecureKey.php @@ -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); }