-
-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathAIFormatter.php
More file actions
32 lines (26 loc) · 740 Bytes
/
AIFormatter.php
File metadata and controls
32 lines (26 loc) · 740 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
32
<?php
declare(strict_types=1);
namespace Brick\Postcode\Formatter;
use Brick\Postcode\CountryPostcodeFormatter;
/**
* Validates and formats postcodes in Anguilla.
*
* Anguilla uses a single postcode for all addresses.
* This formatter accepts both the digits 2640, and the full postcode AI2640.
*
* @see https://en.wikipedia.org/wiki/List_of_postal_codes
*/
final class AIFormatter implements CountryPostcodeFormatter
{
public function hint(): string
{
return 'Anguilla uses a single postcode for all addresses.';
}
public function format(string $postcode): ?string
{
if ($postcode === '2640' || $postcode === 'AI2640') {
return 'AI-2640';
}
return null;
}
}