-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding in non-default option for returning response object #5
base: master
Are you sure you want to change the base?
Adding in non-default option for returning response object #5
Conversation
This should not break any existing code. It defaults to the existing behavior but allows you to set an object level property at object creation time to return response objects rather than strings and arrays from most of the class functions.
src/Response.php
Outdated
if (isset($this->response['scriptResult']) || array_key_exists('scriptResult', $this->response)){ | ||
return $this->response['scriptResult']; | ||
} else { | ||
return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to do something else than just "return;". As of PHP 7.1, that is a compile-time error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JacobTaylor-RCC I updated this code so it will return an empty string if the script result is empty. Unsure if returning null might be more appropriate. Open to your input there.
src/Response.php
Outdated
if (isset($this->response['scriptError']) || array_key_exists('scriptError', $this->response)){ | ||
return $this->response['scriptError']; | ||
} else { | ||
return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above, This needs to do something else than just "return;". As of PHP 7.1, that is a compile-time error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JacobTaylor-RCC I updated this code so it will return an empty string if the script error is empty. Unsure if returning null might be more appropriate. Open to your input there.
Fix those two comments however you wish. I'll merge once you do so :) |
This should not break any existing code. It defaults to the existing behavior but allows you to set an object level property at object creation time to return response objects rather than strings and arrays from most of the class functions.