Closed knit-pay closed 3 years ago
It's fine to use empty()
, but in this specific case there's nothing 'wrong' with checking an empty string as that is exactly what the value results in if a setting in the Charitable gateway is not set or is empty.
I think I've came across gateways which could be enabled in the extension and then result in a null
value if the gateway settings are not saved explicitly, but result in an empty string once the settings are saved (while leaving the setting unset/empty). In these cases, empty()
is a nice and clean solution.
Hello
many extensions set config_id and description variable as null or 0 if it is not set by admin. so it's better to use empty function instead of '' === comparison. It's not only for charitable, it's for other extensions also like give and others. What do you think about it?
https://github.com/wp-pay-extensions/charitable/blob/5a16132dd77af8e56e71da4b79cbe7745a46a2c8/src/Gateway.php#L124
https://github.com/wp-pay-extensions/charitable/blob/5a16132dd77af8e56e71da4b79cbe7745a46a2c8/src/CharitableHelper.php#L52