• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

brick / postcode / 19098978650

05 Nov 2025 10:29AM UTC coverage: 81.719% (-17.7%) from 99.396%
19098978650

Pull #19

github

web-flow
Merge 3d57d0d25 into 8ef37e5aa
Pull Request #19: Add hint to formatter, so a hint can be provided if postcode is invalid

6 of 186 new or added lines in 184 files covered. (3.23%)

827 of 1012 relevant lines covered (81.72%)

15.0 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

80.0
/src/Formatter/ATFormatter.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace Brick\Postcode\Formatter;
6

7
use Brick\Postcode\CountryPostcodeFormatter;
8
use Brick\Postcode\FormatHelper\StripPrefix;
9

10
use function preg_match;
11

12
/**
13
 * Validates and formats postcodes in Austria.
14
 *
15
 * Postcodes consist of 4 digits, without separator. The first digit must be 1-9.
16
 *
17
 * @see https://en.wikipedia.org/wiki/List_of_postal_codes
18
 * @see https://en.wikipedia.org/wiki/Postal_codes_in_Austria
19
 */
20
final class ATFormatter implements CountryPostcodeFormatter
21
{
22
    use StripPrefix;
23

24
    public function hint(): string
25
    {
NEW
26
        return 'Postcodes consist of 4 digits, without separator. The first digit must be 1-9.';
×
27
    }
28

29
    public function format(string $postcode): ?string
30
    {
31
        $postcode = $this->stripPrefix($postcode, 'A');
16✔
32

33
        if (preg_match('/^[1-9][0-9]{3}$/', $postcode) !== 1) {
16✔
34
            return null;
14✔
35
        }
36

37
        return $postcode;
2✔
38
    }
39
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc