Skip to content

Commit 9663c02

Browse files
fix(ibs registar): fallback to product_0_code/message in case main props are n/a
1 parent 01b1933 commit 9663c02

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/IBS/Response.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,12 @@ public function getRequestURL()
9797
*/
9898
public function getCode()
9999
{
100-
return ($this->hash["code"]) ? intval($this->hash["code"]) : 200;
100+
foreach (["code", "product_0_code"] as $key) {
101+
if (isset($this->hash[$key])) {
102+
return intval($this->hash[$key]);
103+
}
104+
}
105+
return 200; // default code
101106
}
102107

103108
/**
@@ -115,7 +120,7 @@ public function getStatus()
115120
*/
116121
public function getDescription()
117122
{
118-
return $this->hash["message"] ?? "Command completed successfully";
123+
return $this->hash["message"] ?? $this->hash["product_0_message"] ?? "Command completed successfully";
119124
}
120125

121126
/**

0 commit comments

Comments
 (0)