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 2
2
3
3
namespace NPR \One \Models ;
4
4
5
+ use JsonSerializable ;
5
6
6
7
/**
7
8
* A thin abstraction to aide in transforming raw JSON into a model, yet allowing it to be re-encoded as JSON when
8
9
* stringified.
9
10
*
10
11
* @package NPR\One\Models
11
12
*/
12
- abstract class JsonModel
13
+ abstract class JsonModel implements JsonSerializable
13
14
{
14
15
/** @var \stdClass - the original json used to construct this model, useful for debugging
15
16
* @internal */
@@ -30,6 +31,14 @@ public function __construct($json)
30
31
}
31
32
}
32
33
34
+ /**
35
+ * JSON Serialize the original JSON object
36
+ */
37
+ public function jsonSerialize ()
38
+ {
39
+ return $ this ->originalJsonObject ;
40
+ }
41
+
33
42
/**
34
43
* Re-encodes the original JSON model as a string and returns it.
35
44
*
You can’t perform that action at this time.
0 commit comments