From c2e1c0ae53245477b72152d8188080676f0108ba Mon Sep 17 00:00:00 2001 From: Tim MacDonald Date: Tue, 31 Mar 2020 17:22:24 +1100 Subject: [PATCH 1/3] expose zip ranges attribute --- src/State.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/State.php b/src/State.php index 59253d6..d55b226 100644 --- a/src/State.php +++ b/src/State.php @@ -31,6 +31,7 @@ class State extends Divisible 'fipsCode' => 'ids.fips', 'isoCode' => 'ids.iso_3166_2', 'geonamesCode' => 'ids.geonames', + 'zipRanges' => 'zip_ranges', 'name' ]; From 0997c61d7301621284101c051465213a38f05dd3 Mon Sep 17 00:00:00 2001 From: Tim MacDonald Date: Tue, 31 Mar 2020 17:29:12 +1100 Subject: [PATCH 2/3] ensure ranges is always an array --- src/State.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/State.php b/src/State.php index d55b226..c388d68 100644 --- a/src/State.php +++ b/src/State.php @@ -42,4 +42,18 @@ public function getCities() { return $this->getMembers(); } + + /** + * @return array + */ + public function getZipRanges() + { + $ranges = $this->meta['zip_ranges']; + + if ($zip_ranges === null) { + return []; + } + + return $ranges; + } } From 0e776a089c7560ce1920b0ee1a9c960da318e8a4 Mon Sep 17 00:00:00 2001 From: Denis Mysenko Date: Tue, 31 Mar 2020 17:42:51 +1100 Subject: [PATCH 3/3] Remove unnecessary method (there is a magic method already) --- src/State.php | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/src/State.php b/src/State.php index c388d68..494cdb9 100644 --- a/src/State.php +++ b/src/State.php @@ -31,7 +31,7 @@ class State extends Divisible 'fipsCode' => 'ids.fips', 'isoCode' => 'ids.iso_3166_2', 'geonamesCode' => 'ids.geonames', - 'zipRanges' => 'zip_ranges', + 'postCodes' => 'postcodes', 'name' ]; @@ -42,18 +42,4 @@ public function getCities() { return $this->getMembers(); } - - /** - * @return array - */ - public function getZipRanges() - { - $ranges = $this->meta['zip_ranges']; - - if ($zip_ranges === null) { - return []; - } - - return $ranges; - } }