| Conditions | 3 |
| Paths | 2 |
| Total Lines | 14 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php |
||
| 25 | 141 | public function rewrite(AccountNumber $account): AccountNumber |
|
| 26 | { |
||
| 27 | 141 | if ($this->minimalLength && strlen($account->getSerialNumber()) <= $this->minimalLength) { |
|
| 28 | 39 | return $account; |
|
| 29 | } |
||
| 30 | |||
| 31 | 139 | return new UndefinedAccount( |
|
| 32 | 139 | $account->getRawNumber(), |
|
| 33 | 139 | $account->getClearingNumber(), |
|
| 34 | 139 | $account->getClearingCheckDigit(), |
|
| 35 | 139 | str_pad(ltrim($account->getSerialNumber(), '0'), $this->minimalLength, '0', STR_PAD_LEFT), |
|
| 36 | 139 | $account->getCheckDigit() |
|
| 37 | ); |
||
| 38 | } |
||
| 39 | } |
||
| 40 |