File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -16,4 +16,36 @@ public function format(array $record)
16
16
$ output = parent ::format ($ record );
17
17
return rtrim ($ output ) . "\n" ;
18
18
}
19
+
20
+ protected function convertToString ($ data )
21
+ {
22
+ $ decoded = is_json ($ data , true );
23
+ if ($ decoded ) {
24
+ $ data = $ decoded ;
25
+ }
26
+
27
+ if (is_string ($ data )) {
28
+ return $ data ;
29
+ }
30
+
31
+ return var_export ($ data , true );
32
+ }
33
+ }
34
+
35
+
36
+
37
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
38
+ function is_json ($ string , $ return = false )
39
+ {
40
+ if (!is_string ($ string )) {
41
+ return false ;
42
+ }
43
+
44
+ $ data = json_decode ($ string );
45
+ if (json_last_error () != JSON_ERROR_NONE ) {
46
+ return false ;
47
+ }
48
+
49
+ return ($ return ? $ data : true );
19
50
}
51
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
You can’t perform that action at this time.
0 commit comments