Closed hanneskod closed 6 years ago
Version 2.0-dev contains a regression here. Should this be supported?
Implement using formatters. Lets go
interface FormatterInterface
{
public function format(AccountNumber $number): string;
}
An in AccountNumber
public function format(FormatterInterface $formatter): string
{
return $formatter->format($this);
}
public function getNumber(): string
{
return $this->format(new StandardFormatter);
}
public function get16(): string
{
return $this->format(new Generic16Formatter);
}
public function prettyprint(): string
{
return $this->format(new PrettyprintingFormatter);
}
Let StandardFormatter
do 1234-5,123456-7
.
Let PrettyprintingFormatter
do 1234-5,123 456-7
and 3300,760212-1234
.
Then we also need BangiroFormatter
and PlusgiroFormatter
. And some permutation-testing of BangiroFactory
and PlusgiroFactory
as is currently done in IntegrationTest
. (For example prettyprinting a bankgiro number should parse as the same number...)
Concerns the pretty format feature...