@@ -14,6 +14,5 @@ |
||
| 14 | 14 | * @author Joe Huss <[email protected]> |
| 15 | 15 | */ |
| 16 | 16 | |
| 17 | -class ValidationException extends \Exception |
|
| 18 | -{ |
|
| 17 | +class ValidationException extends \Exception { |
|
| 19 | 18 | } |
@@ -8,8 +8,7 @@ |
||
| 8 | 8 | * @return array |
| 9 | 9 | * @internal param mixed $ |
| 10 | 10 | */ |
| 11 | -function get_codes_from($what, $codes) |
|
| 12 | -{ |
|
| 11 | +function get_codes_from($what, $codes) { |
|
| 13 | 12 | $what = explode(',', $what); |
| 14 | 13 | foreach ($what as $eachArea) { |
| 15 | 14 | if (trim($eachArea) != '' && trim($eachArea) != '- no codes -') { |
@@ -12,8 +12,7 @@ discard block |
||
| 12 | 12 | * |
| 13 | 13 | * @author Joe Huss <[email protected]> |
| 14 | 14 | */ |
| 15 | -class Validator |
|
| 16 | -{ |
|
| 15 | +class Validator { |
|
| 17 | 16 | protected $zipNames = [ |
| 18 | 17 | 'BR' => ['name' => 'CEP', 'acronym_text' => 'Código de endereçamento postal (Postal Addressing Code)'], |
| 19 | 18 | 'CA' => ['name' => 'Postal Code', 'acronym_text' => ''], |
@@ -292,8 +291,7 @@ discard block |
||
| 292 | 291 | * @return bool |
| 293 | 292 | * @throws \Detain\ZipZapper\ValidationException |
| 294 | 293 | */ |
| 295 | - public function isValid($countryCode, $postalCode, $ignoreSpaces = false) |
|
| 296 | - { |
|
| 294 | + public function isValid($countryCode, $postalCode, $ignoreSpaces = false) { |
|
| 297 | 295 | //$postalCode = str_replace('-', '', $postalCode); |
| 298 | 296 | if (!isset($this->formats[$countryCode])) { |
| 299 | 297 | throw new ValidationException(sprintf('Invalid country code: "%s"', $countryCode)); |
@@ -318,8 +316,7 @@ discard block |
||
| 318 | 316 | * @return mixed |
| 319 | 317 | * @throws \Detain\ZipZapper\ValidationException |
| 320 | 318 | */ |
| 321 | - public function getFormats($countryCode) |
|
| 322 | - { |
|
| 319 | + public function getFormats($countryCode) { |
|
| 323 | 320 | if (!isset($this->formats[$countryCode])) { |
| 324 | 321 | throw new ValidationException(sprintf('Invalid country code: "%s"', $countryCode)); |
| 325 | 322 | } |
@@ -331,8 +328,7 @@ discard block |
||
| 331 | 328 | * @param $countryCode |
| 332 | 329 | * @return bool |
| 333 | 330 | */ |
| 334 | - public function hasCountry($countryCode) |
|
| 335 | - { |
|
| 331 | + public function hasCountry($countryCode) { |
|
| 336 | 332 | return isset($this->formats[$countryCode]); |
| 337 | 333 | } |
| 338 | 334 | |
@@ -341,8 +337,7 @@ discard block |
||
| 341 | 337 | * @param bool $ignoreSpaces |
| 342 | 338 | * @return string |
| 343 | 339 | */ |
| 344 | - protected function getFormatPattern($format, $ignoreSpaces = false) |
|
| 345 | - { |
|
| 340 | + protected function getFormatPattern($format, $ignoreSpaces = false) { |
|
| 346 | 341 | //$format = str_replace('-', '', $format); |
| 347 | 342 | $pattern = str_replace('#', '\d', $format); |
| 348 | 343 | $pattern = str_replace('@', '[a-zA-Z]', $pattern); |
@@ -358,8 +353,7 @@ discard block |
||
| 358 | 353 | * @param $countryCode |
| 359 | 354 | * @return string |
| 360 | 355 | */ |
| 361 | - public function getZipName($countryCode) |
|
| 362 | - { |
|
| 356 | + public function getZipName($countryCode) { |
|
| 363 | 357 | if (isset($this->zipNames[$countryCode])) { |
| 364 | 358 | $name = $this->zipNames[$countryCode]['name']; |
| 365 | 359 | } else { |