function json_encode in Lockr 7.3
Wrapper for JSON encoding that throws when an error occurs.
@link http://www.php.net/manual/en/function.json-encode.php
Parameters
mixed $value The value being encoded:
int $options JSON encode option bitmask:
int $depth Set the maximum depth. Must be greater than zero.:
Return value
string
Throws
\InvalidArgumentException if the JSON cannot be encoded.
File
- vendor/
guzzlehttp/ guzzle/ src/ functions.php, line 323
Namespace
GuzzleHttpCode
function json_encode($value, $options = 0, $depth = 512) {
$json = \json_encode($value, $options, $depth);
if (JSON_ERROR_NONE !== json_last_error()) {
throw new \InvalidArgumentException('json_encode error: ' . json_last_error_msg());
}
return $json;
}