ParseResult
Gatepost\Postcode\ParseResult
The result of Postcode::parse(): a postcode, or the reason that the input is not one. Exactly one of value and error is set.
$result = Postcode::parse($input);if ($result->isOk()) { echo $result->value->canonical;} else { echo $result->error->code->value;}Members
Section titled “Members”?Postcode $value: The postcode, or null when the parse failed.?ParseError $error: Why the parse failed, or null when it succeeded.
Methods
Section titled “Methods”isOk()
Section titled “isOk()”public function isOk(): boolTells whether the parse found a postcode. Static analysers such as PHPStan then know which of value and error is set.
Unofficial. Not made or endorsed by NIPOST.