+ [feat] ensure $_result is always an object
This commit is contained in:
+4
-8
@@ -48,16 +48,12 @@ if(isset($codeCoverageConfig) and $codeCoverageConfig == 'true')
|
||||
*/
|
||||
function ensureObject($data)
|
||||
{
|
||||
if (is_object($data)) {
|
||||
return $data;
|
||||
}
|
||||
if(is_object($data)) return $data;
|
||||
|
||||
if (is_string($data)) {
|
||||
if(is_string($data))
|
||||
{
|
||||
$decoded = json_decode($data);
|
||||
|
||||
if (json_last_error() === JSON_ERROR_NONE) {
|
||||
return $decoded;
|
||||
}
|
||||
if(json_last_error() === JSON_ERROR_NONE) return $decoded;
|
||||
}
|
||||
|
||||
return $data;
|
||||
|
||||
Reference in New Issue
Block a user