From 6227a4c074d7e6f2e08c0cc90b81ea3fcbd41a48 Mon Sep 17 00:00:00 2001 From: MichaelMackus Date: Wed, 22 Jun 2016 06:47:25 -0700 Subject: [PATCH] Fix for zip codes with leading zeros (#4) * Fix for zip codes with leading zeros * Update postal code doc type * Change zipcode type to string --- src/Lookup.php | 8 ++++---- src/LookupModel.php | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Lookup.php b/src/Lookup.php index 0573be8..dec8d26 100644 --- a/src/Lookup.php +++ b/src/Lookup.php @@ -5,7 +5,7 @@ class Lookup { - const ZIPTASTIC_LOOKUP_URL = 'https://zip.getziptastic.com/v3/%s/%d'; + const ZIPTASTIC_LOOKUP_URL = 'https://zip.getziptastic.com/v3/%s/%s'; /** * @var ServiceInterface; @@ -42,12 +42,12 @@ public static function create($apiKey = null, $countryCode = 'US') /** * Get information on given $zipCode - * @param int $zipCode + * @param string $zipCode * @return array[LookupModel] */ public function lookup($zipCode) { - $url = sprintf(self::ZIPTASTIC_LOOKUP_URL, $this->countryCode, $zipCode); + $url = sprintf(self::ZIPTASTIC_LOOKUP_URL, $this->countryCode, (string) $zipCode); $res = $this->service->get($url, $this->apiKey); $collection = []; @@ -57,4 +57,4 @@ public function lookup($zipCode) return $collection; } -} \ No newline at end of file +} diff --git a/src/LookupModel.php b/src/LookupModel.php index d7759c4..e0ba298 100644 --- a/src/LookupModel.php +++ b/src/LookupModel.php @@ -25,7 +25,7 @@ class LookupModel private $stateShort; /** - * @var int + * @var string */ private $postalCode; @@ -95,7 +95,7 @@ public function stateShort() } /** - * @return int + * @return string */ public function postalCode() {