File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change 22
33namespace NPR \One \Models ;
44
5+ use JsonSerializable ;
56
67/**
78 * A thin abstraction to aide in transforming raw JSON into a model, yet allowing it to be re-encoded as JSON when
89 * stringified.
910 *
1011 * @package NPR\One\Models
1112 */
12- abstract class JsonModel
13+ abstract class JsonModel implements JsonSerializable
1314{
1415 /** @var \stdClass - the original json used to construct this model, useful for debugging
1516 * @internal */
@@ -30,6 +31,14 @@ public function __construct($json)
3031 }
3132 }
3233
34+ /**
35+ * JSON Serialize the original JSON object
36+ */
37+ public function jsonSerialize ()
38+ {
39+ return $ this ->originalJsonObject ;
40+ }
41+
3342 /**
3443 * Re-encodes the original JSON model as a string and returns it.
3544 *
You can’t perform that action at this time.
0 commit comments