-
-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathCountryPostcodeFormatter.php
More file actions
31 lines (27 loc) · 840 Bytes
/
CountryPostcodeFormatter.php
File metadata and controls
31 lines (27 loc) · 840 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php
declare(strict_types=1);
namespace Brick\Postcode;
/**
* Validates and formats postcodes for a country.
*
* If the implementation defines a constructor, this must not take any parameters.
*/
interface CountryPostcodeFormatter
{
/**
* Validates and formats the given postcode.
*
* The postcode must be a non-empty string of uppercase alphanumeric characters, with no separator.
*
* @param string $postcode The postcode to format.
*
* @return string|null The formatted postcode, or NULL if the postcode is invalid.
*/
public function format(string $postcode): ?string;
/**
* Returns a hint describing the expected postcode format for this country.
*
* @return string A hint describing the expected postcode format.
*/
public function hint(): string;
}