Skip to content

Commit 3d849ec

Browse files
Revert "add validation on zipcode"
This reverts commit bcf8fa5.
1 parent bcf8fa5 commit 3d849ec

File tree

6 files changed

+1
-85
lines changed

6 files changed

+1
-85
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,4 +82,3 @@ fabric.properties
8282

8383
# Android studio 3.1+ serialized cache file
8484
.idea/caches/build_file_checksums.ser
85-
/docker/php-fpm

docker-compose.yml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,3 @@ services:
77
- "./:/usr/src/app"
88
working_dir: "/usr/src/app/"
99
user: ${CURRENT_UID:-1000}
10-
php-fpm:
11-
build: ./docker/php-fpm
12-
container_name: php-fpm
13-
working_dir: /application
14-
volumes:
15-
- .:/application
16-
- ./docker/php-fpm/php-ini-overrides.ini:/etc/php/7.4/fpm/conf.d/99-overrides.ini
17-
- ./docker/php-fpm/php-ini-overrides.ini:/etc/php/7.4/php-fpm/conf.d/99-overrides.ini
18-
ports:
19-
- 8090:80

src/Geography/Address/ByCountry/Us/ZipCode.php

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,28 +5,10 @@
55
namespace Talentify\ValueObject\Geography\Address\ByCountry\Us;
66

77
use Talentify\ValueObject\Geography\Address\PostalCode;
8-
use Talentify\ValueObject\StringUtils;
98

109
/**
1110
* @see https://en.wikipedia.org/wiki/ZIP_Code
1211
*/
1312
class ZipCode extends PostalCode
1413
{
15-
public function setValue(string $value): void
16-
{
17-
$value = StringUtils::trimSpacesWisely($value);
18-
$changedValue = StringUtils::removeNonWordCharacters($value);
19-
$characters = StringUtils::countCharacters($changedValue);
20-
21-
if ($characters == 4) {
22-
$value = '0' . $value;
23-
$characters++;
24-
}
25-
26-
if (empty($value) || $characters !=5 && $characters != 9) {
27-
throw new \InvalidArgumentException(sprintf('The value "%s" is not a valid postal code.', $value));
28-
}
29-
30-
parent::setValue($value);
31-
}
3214
}

src/Geography/Address/PostalCode.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public function __construct(string $value)
2424
$this->setValue($value);
2525
}
2626

27-
public function setValue(string $value) : void
27+
private function setValue(string $value) : void
2828
{
2929
$normalized = StringUtils::trimSpacesWisely($value);
3030
if (empty($normalized)) {

src/StringUtils.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,4 @@ public static function convertCaseToLower(string $value) : string
4949
{
5050
return mb_convert_case($value, MB_CASE_LOWER, 'UTF-8');
5151
}
52-
53-
public static function countCharacters(string $value) : int
54-
{
55-
return strlen($value);
56-
}
5752
}

tests/Geography/Address/ByCountry/Us/ZipcodeTest.php

Lines changed: 0 additions & 50 deletions
This file was deleted.

0 commit comments

Comments
 (0)