Skip to content
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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

joneisen
Copy link
Member

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.

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;
Copy link
Member

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.

https://www.php.net/manual/en/function.return.php

Copy link
Member Author

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;
Copy link
Member

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.

https://www.php.net/manual/en/function.return.php

Copy link
Member Author

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.

@JacobTaylor-RCC
Copy link
Member

Fix those two comments however you wish. I'll merge once you do so :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants