src/Visitor/Json/JsonDeserializationVisitor.php 1 location
|
@@ 54-63 (lines=10) @@
|
51 |
|
/** |
52 |
|
* {@inheritdoc} |
53 |
|
*/ |
54 |
|
protected function decode($data) |
55 |
|
{ |
56 |
|
$result = @json_decode($data, true, $this->maxDepth, $this->options); |
57 |
|
|
58 |
|
if (json_last_error() !== JSON_ERROR_NONE) { |
59 |
|
throw new \InvalidArgumentException(json_last_error_msg()); |
60 |
|
} |
61 |
|
|
62 |
|
return $result; |
63 |
|
} |
64 |
|
} |
65 |
|
|
src/Visitor/Json/JsonSerializationVisitor.php 1 location
|
@@ 72-81 (lines=10) @@
|
69 |
|
/** |
70 |
|
* {@inheritdoc} |
71 |
|
*/ |
72 |
|
protected function encode($data) |
73 |
|
{ |
74 |
|
$result = @json_encode($data, $this->options); |
75 |
|
|
76 |
|
if (json_last_error() !== JSON_ERROR_NONE) { |
77 |
|
throw new \InvalidArgumentException(json_last_error_msg()); |
78 |
|
} |
79 |
|
|
80 |
|
return $result; |
81 |
|
} |
82 |
|
} |
83 |
|
|