Last active
September 29, 2015 13:12
-
-
Save puiutucutu/06f6b2361fddeb3e396a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Checks for a partial match in the geocode response | |
* | |
* @return boolean | |
*/ | |
public function isPartialResponse() { | |
if (isset($this->geocodeResponse['results'][0]['partial_match']) && $this->geocodeResponse['results'][0]['partial_match'] == 'true') | |
return true; | |
return false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Decision / Solution
Initially I went with option 1, opting to use two independent if structures which also allowed for early escaping. The one problem I have with this is the alternating false, true, and default false return pathway.
I could instead change the second if condition to say...
instead of...
and then the return structure would be false, false, default to true. Also worth noting here is that PHP interprets
[partial_match] = 1
as boolean true.However...
I have decided to use the following code. It still allows for escaping early on the first conditional if and also reduces the return pathways to two, at the expense of having a nested if structure.