File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed
src/EdgeTelemetrics/JSON_RPC Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change 22
33namespace EdgeTelemetrics \JSON_RPC ;
44
5- class Response implements \JsonSerializable {
5+ use \JsonSerializable ;
6+ use \RuntimeException ;
7+
8+ class Response implements JsonSerializable {
69
710 const JSONRPC_VERSION = '2.0 ' ;
811
@@ -11,7 +14,7 @@ class Response implements \JsonSerializable {
1114 */
1215 protected $ id ;
1316
14- protected $ result ;
17+ protected $ result = null ;
1518
1619 /**
1720 * @var Error
@@ -31,7 +34,7 @@ public function getId()
3134 public function setResult ($ result )
3235 {
3336 $ this ->result = $ result ;
34- unset( $ this ->error ) ; //Error must not exist if call is successful
37+ $ this ->error = null ; //Error must not exist if call is successful
3538 }
3639
3740 public function getResult ()
@@ -47,7 +50,7 @@ public function isSuccess()
4750 public function setError (Error $ error )
4851 {
4952 $ this ->error = $ error ;
50- unset( $ this ->result ) ; //Result must not exist if an error is set
53+ $ this ->result = null ; //Result must not exist if an error is set
5154 }
5255
5356 public function getError ()
@@ -77,7 +80,7 @@ public function jsonSerialize()
7780 }
7881 else
7982 {
80- throw new \ RuntimeException ('Response must be successful or error state ' );
83+ throw new RuntimeException ('Response must be successful or error state ' );
8184 }
8285 return $ record ;
8386 }
You can’t perform that action at this time.
0 commit comments