From 1bb871dca837485e4d8d6e710066265386c90e75 Mon Sep 17 00:00:00 2001 From: Hugo Fonseca Date: Thu, 5 Mar 2015 22:01:09 +0000 Subject: [PATCH] Add docBlock and fix CS --- src/Composer/Json/JsonFile.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/Composer/Json/JsonFile.php b/src/Composer/Json/JsonFile.php index 7fbc42392..b514e5b43 100644 --- a/src/Composer/Json/JsonFile.php +++ b/src/Composer/Json/JsonFile.php @@ -215,21 +215,27 @@ class JsonFile return $result; } + /** + * Throws an exception according to a given code with a customized message + * + * @param int $code return code of json_last_error function + * @throws \RuntimeException + */ private static function throwEncodeError($code) { switch ($code) { case JSON_ERROR_DEPTH: $msg = 'Maximum stack depth exceeded'; - break; + break; case JSON_ERROR_STATE_MISMATCH: $msg = 'Underflow or the modes mismatch'; - break; + break; case JSON_ERROR_CTRL_CHAR: $msg = 'Unexpected control character found'; - break; + break; case JSON_ERROR_UTF8: $msg = 'Malformed UTF-8 characters, possibly incorrectly encoded'; - break; + break; default: $msg = 'Unknown error'; }