From 11ccbc45172f939f2bed976bce0583a17ff87920 Mon Sep 17 00:00:00 2001 From: Giorgio Premi Date: Fri, 13 Feb 2015 10:30:23 +0100 Subject: [PATCH] Minor syntax fixes --- src/Geocoder/Formatter/StringFormatter.php | 14 +++++++------- src/Geocoder/Provider/GeoIPs.php | 11 +++++++++-- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/src/Geocoder/Formatter/StringFormatter.php b/src/Geocoder/Formatter/StringFormatter.php index 9d547c747..1ca09d808 100644 --- a/src/Geocoder/Formatter/StringFormatter.php +++ b/src/Geocoder/Formatter/StringFormatter.php @@ -49,7 +49,7 @@ class StringFormatter */ public function format(Address $address, $format) { - $tr = [ + $replace = [ self::STREET_NUMBER => $address->getStreetNumber(), self::STREET_NAME => $address->getStreetName(), self::LOCALITY => $address->getLocality(), @@ -60,16 +60,16 @@ public function format(Address $address, $format) self::TIMEZONE => $address->getTimezone(), ]; - for ($level = 1; $level <= AdminLevelCollection::MAX_LEVEL_DEPTH; ++ $level) { - $tr[self::ADMIN_LEVEL . $level] = null; - $tr[self::ADMIN_LEVEL_CODE . $level] = null; + for ($level = 1; $level <= AdminLevelCollection::MAX_LEVEL_DEPTH; $level ++) { + $replace[self::ADMIN_LEVEL . $level] = null; + $replace[self::ADMIN_LEVEL_CODE . $level] = null; } foreach ($address->getAdminLevels() as $level => $adminLevel) { - $tr[self::ADMIN_LEVEL . $level] = $adminLevel->getName(); - $tr[self::ADMIN_LEVEL_CODE . $level] = $adminLevel->getCode(); + $replace[self::ADMIN_LEVEL . $level] = $adminLevel->getName(); + $replace[self::ADMIN_LEVEL_CODE . $level] = $adminLevel->getCode(); } - return strtr($format, $tr); + return strtr($format, $replace); } } diff --git a/src/Geocoder/Provider/GeoIPs.php b/src/Geocoder/Provider/GeoIPs.php index 2913236d3..438775555 100644 --- a/src/Geocoder/Provider/GeoIPs.php +++ b/src/Geocoder/Provider/GeoIPs.php @@ -172,11 +172,18 @@ private function executeQuery($query) $adminLevels = []; if (null !== $location['region_name'] || null !== $location['region_code']) { - $adminLevels[] = ['name' => $location['region_name'], 'code' => $location['region_code'], 'level' => 1]; + $adminLevels[] = [ + 'name' => $location['region_name'], + 'code' => $location['region_code'], + 'level' => 1 + ]; } if (null !== $location['county_name']) { - $adminLevels[] = ['name' => $location['county_name'], 'level' => 2]; + $adminLevels[] = [ + 'name' => $location['county_name'], + 'level' => 2 + ]; } $results = [];