File tree Expand file tree Collapse file tree 1 file changed +9
-11
lines changed Expand file tree Collapse file tree 1 file changed +9
-11
lines changed Original file line number Diff line number Diff line change @@ -170,23 +170,21 @@ public function isJson($value, $return_map = false)
170
170
171
171
return (json_last_error () == JSON_ERROR_NONE ) ? ($ return_map ? $ data : true ) : json_last_error_msg ();
172
172
}
173
- protected function prepareResult ($ data , $ object )
173
+
174
+ /**
175
+ * @param mixed $data
176
+ * @param bool $isObject
177
+ * @return array
178
+ */
179
+ protected function prepareResult ($ data , $ isObject )
174
180
{
175
181
$ output = [];
176
182
if (is_array ($ data )) {
177
183
foreach ($ data as $ key => $ val ) {
178
- if ($ object ) {
179
- $ output [$ key ] = (object ) $ val ;
180
- } else {
181
- $ output [$ key ] = $ val ;
182
- }
184
+ $ output [$ key ] = $ isObject ? (object ) $ val : $ val ;
183
185
}
184
186
} else {
185
- if ($ object ) {
186
- $ output = json_decode (json_encode ($ data ));
187
- } else {
188
- $ output = json_decode (json_encode ($ data ), true );
189
- }
187
+ $ output = json_decode (json_encode ($ data ), $ isObject );
190
188
}
191
189
192
190
return $ output ;
You can’t perform that action at this time.
0 commit comments