File tree Expand file tree Collapse file tree 3 files changed +16
-10
lines changed
Expand file tree Collapse file tree 3 files changed +16
-10
lines changed Original file line number Diff line number Diff line change @@ -285,7 +285,13 @@ protected function handleDataResponse($response)
285285 if (property_exists ($ content , 'data ' )) {
286286 $ data = $ content ->data ;
287287 }
288- if (count ($ data ) == 1 && empty ($ data [0 ])) {
288+
289+ // Handle case where API returns object instead of array (e.g., otp_devices endpoint)
290+ if (is_object ($ data )) {
291+ return $ data ;
292+ }
293+
294+ if (is_array ($ data ) && count ($ data ) == 1 && empty ($ data [0 ])) {
289295 return [];
290296 }
291297
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ class AuthFactor
1616 public function __construct ($ data )
1717 {
1818 $ this ->id = isset ($ data ->factor_id )? (int ) $ data ->factor_id : null ;
19- $ this ->name = $ data ->name ;
19+ $ this ->name = $ data ->name ?? '' ;
2020 }
2121
2222 public function getId ()
Original file line number Diff line number Diff line change @@ -37,13 +37,13 @@ class OTPDevice
3737 public function __construct ($ data )
3838 {
3939 $ this ->id = isset ($ data ->id )? (int ) $ data ->id : null ;
40- $ this ->active = $ data ->active ;
41- $ this ->default = $ data ->default ;
42- $ this ->authFactorName = $ data ->auth_factor_name ;
43- $ this ->phoneNumber = $ data ->phone_number ;
44- $ this ->typeDisplayName = $ data ->type_display_name ;
45- $ this ->needsTrigger = $ data ->needs_trigger ;
46- $ this ->userDisplayName = $ data ->user_display_name ;
47- $ this ->stateToken = $ data ->state_token ;
40+ $ this ->active = $ data ->active ?? '' ;
41+ $ this ->default = $ data ->default ?? '' ;
42+ $ this ->authFactorName = $ data ->auth_factor_name ?? '' ;
43+ $ this ->phoneNumber = $ data ->phone_number ?? '' ;
44+ $ this ->typeDisplayName = $ data ->type_display_name ?? '' ;
45+ $ this ->needsTrigger = $ data ->needs_trigger ?? '' ;
46+ $ this ->userDisplayName = $ data ->user_display_name ?? '' ;
47+ $ this ->stateToken = $ data ->state_token ?? '' ;
4848 }
4949}
You can’t perform that action at this time.
0 commit comments