File tree Expand file tree Collapse file tree 1 file changed +35
-2
lines changed Expand file tree Collapse file tree 1 file changed +35
-2
lines changed Original file line number Diff line number Diff line change @@ -69,6 +69,22 @@ public function asArray($data)
69
69
return (array ) $ data ;
70
70
}
71
71
72
+ /**
73
+ * Convert the data items to array.
74
+ *
75
+ * @return array
76
+ */
77
+ public function toArray ()
78
+ {
79
+ return array_map (function ($ value ) {
80
+ if (\is_scalar ($ value )) {
81
+ return $ value ;
82
+ }
83
+
84
+ return $ this ->asArray ($ value );
85
+ }, $ this ->data );
86
+ }
87
+
72
88
/**
73
89
* Flatten a multi dimension array to 1 dimension.
74
90
*
@@ -192,10 +208,27 @@ public function jsonSerialize()
192
208
*/
193
209
public function __toString ()
194
210
{
195
- return \json_encode ($ this ->data );
211
+ return \json_encode ($ this ->toArray () );
196
212
}
197
213
198
- public static function _ ($ data )
214
+ /**
215
+ * The current time in millisec.
216
+ *
217
+ * @return float
218
+ */
219
+ public function now ()
220
+ {
221
+ return microtime (1 ) * 1000 ;
222
+ }
223
+
224
+ /**
225
+ * A static shortcut to constructor.
226
+ *
227
+ * @param mixed $data
228
+ *
229
+ * @return self
230
+ */
231
+ public static function _ ($ data = null )
199
232
{
200
233
return new static ($ data );
201
234
}
You can’t perform that action at this time.
0 commit comments