Skip to content

Commit 6227a4c

Browse files
MichaelMackusdaspecster
authored andcommitted
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
1 parent f66ff57 commit 6227a4c

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/Lookup.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
class Lookup
77
{
8-
const ZIPTASTIC_LOOKUP_URL = 'https://zip.getziptastic.com/v3/%s/%d';
8+
const ZIPTASTIC_LOOKUP_URL = 'https://zip.getziptastic.com/v3/%s/%s';
99

1010
/**
1111
* @var ServiceInterface;
@@ -42,12 +42,12 @@ public static function create($apiKey = null, $countryCode = 'US')
4242

4343
/**
4444
* Get information on given $zipCode
45-
* @param int $zipCode
45+
* @param string $zipCode
4646
* @return array[LookupModel]
4747
*/
4848
public function lookup($zipCode)
4949
{
50-
$url = sprintf(self::ZIPTASTIC_LOOKUP_URL, $this->countryCode, $zipCode);
50+
$url = sprintf(self::ZIPTASTIC_LOOKUP_URL, $this->countryCode, (string) $zipCode);
5151
$res = $this->service->get($url, $this->apiKey);
5252

5353
$collection = [];
@@ -57,4 +57,4 @@ public function lookup($zipCode)
5757

5858
return $collection;
5959
}
60-
}
60+
}

src/LookupModel.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class LookupModel
2525
private $stateShort;
2626

2727
/**
28-
* @var int
28+
* @var string
2929
*/
3030
private $postalCode;
3131

@@ -95,7 +95,7 @@ public function stateShort()
9595
}
9696

9797
/**
98-
* @return int
98+
* @return string
9999
*/
100100
public function postalCode()
101101
{

0 commit comments

Comments
 (0)