}
if ($this->bNameDetails) {
- if ($aPlace['names']) {
- $aPlace['sNameDetails'] = json_decode($aPlace['names']);
- } else {
- $aPlace['sNameDetails'] = (object) array();
- }
+ $aPlace['sNameDetails'] = $this->extractNames($aPlace['names']);
}
$aPlace['addresstype'] = ClassTypes\getLabelTag(
return $aResults;
}
+
+ private function extractNames($sNames)
+ {
+ if (!$sNames) {
+ return (object) array();
+ }
+
+ $aFullNames = json_decode($sNames);
+ $aNames = array();
+
+ foreach ($aFullNames as $sKey => $sValue) {
+ if (strpos($sKey, '_place_') === 0) {
+ $sSubKey = substr($sKey, 7);
+ if (array_key_exists($sSubKey, $aFullNames)) {
+ $aNames[$sKey] = $sValue;
+ } else {
+ $aNames[$sSubKey] = $sValue;
+ }
+ } else {
+ $aNames[$sKey] = $sValue;
+ }
+ }
+
+ return $aNames;
+ }
+
+
/* returns an array which will contain the keys
* aBoundingBox
* and may also contain one or more of the keys
* lat
* lon
*/
-
-
public function getOutlines($iPlaceID, $fLon = null, $fLat = null, $fRadius = null, $fLonReverse = null, $fLatReverse = null)
{
| object | linked_place_id |
| N2 | R13 |
When sending search query "Vario"
+ | namedetails |
+ | 1 |
Then results contain
- | osm | display_name |
- | R13 | Garbo |
+ | osm | display_name | namedetails |
+ | R13 | Garbo | "name": "Garbo", "name:it": "Vario" |
When sending search query "Vario"
| accept-language |
| it |
| object | linked_place_id |
| N2 | R13 |
When sending search query "Vario"
+ | namedetails |
+ | 1 |
Then results contain
- | osm | display_name |
- | R13 | Garbo |
+ | osm | display_name | namedetails |
+ | R13 | Garbo | "name": "Garbo", "_place_name": "Vario" |
When sending search query "Garbo"
Then results contain
| osm | display_name |
elif value.startswith("^"):
assert re.fullmatch(value, self.result[idx][field]), \
BadRowValueAssert(self, idx, field, value)
+ elif isinstance(self.result[idx][field], OrderedDict):
+ assert self.result[idx][field] == eval('{' + value + '}'), \
+ BadRowValueAssert(self, idx, field, value)
else:
assert str(self.result[idx][field]) == str(value), \
BadRowValueAssert(self, idx, field, value)