Updates to Sample Code

- Updated UI Presentation on samples
- Fixed Bugs
This commit is contained in:
japatel
2014-11-02 17:06:58 -06:00
parent 4d481ad104
commit 3c02790138
97 changed files with 904 additions and 1249 deletions

View File

@@ -14,14 +14,18 @@ class JsonValidator
* Helper method for validating if string provided is a valid json.
*
* @param string $string String representation of Json object
* @param bool $silent Flag to not throw \InvalidArgumentException
* @return bool
*/
public static function validate($string)
public static function validate($string, $silent = false)
{
json_decode($string);
if (json_last_error() != JSON_ERROR_NONE) {
//Throw an Exception for string or array
throw new \InvalidArgumentException("Invalid JSON String");
if ($silent == false) {
//Throw an Exception for string or array
throw new \InvalidArgumentException("Invalid JSON String");
}
return false;
}
return true;
}