-
-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Created Hungarian IBAN adapter and validator #8
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also please add tests that cover an IBAN with invalid length. Also a test that covers valid behavior for the $checkString
callback, I aim for 100% code coverage and lines 43 and 53 in HungarianIbanAdapter are currently uncovered.
src/Iban/HungarianIbanAdapter.php
Outdated
public function getValidator(): ?ValidatorInterface | ||
{ | ||
return new CompoundValidator( | ||
new HungarianIbanValidator($this->account), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would be better if it accepted the object itself because the validators can be used on its own.
new HungarianIbanValidator($this->account), | |
new HungarianIbanValidator($this), |
private $accountNumber; | ||
|
||
public function __construct(string $accountNumber) | ||
{ | ||
$this->accountNumber = (string) preg_replace('/[\s\-]+/', '', $accountNumber); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tying to the comment above, this should be replaced to accept the object itself. I won't replace everything that should be fixed in this code review, you get the idea.
private $accountNumber; | |
public function __construct(string $accountNumber) | |
{ | |
$this->accountNumber = (string) preg_replace('/[\s\-]+/', '', $accountNumber); | |
} | |
private $iban; | |
public function __construct(HungarianIbanAdapter $iban) | |
{ | |
$this->iban = $iban; | |
} | |
@RikudouSage I've made the requested changes. Unfortunately I can not check the code coverage, but the exception is now tested here: 0043348#diff-641d0e156eba7b338014f48235b20a07445e41976b4f58ccbf532a8126afb91eR19 |
Thanks! There are still some uncovered lines: https://coveralls.io/builds/48116530/source?filename=src%2FValidator%2FHungarianIbanValidator.php |
Now? |
Perfect, thanks! |
Could you please make a release so I could close this PR hubipe/QrPaymentHU#1 ? |
I did it right after I updated readme. |
Hi,
I implemented the Hungarian IBAN adapter and Validator as a part of QrPaymentHU library. As you suggested in opened issue I created this PR to be able to move the classes to this library instead and not having it bundled in the QrPaymentHU library.