Skip to content
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

Merged
merged 3 commits into from
Apr 8, 2022
Merged

Created Hungarian IBAN adapter and validator #8

merged 3 commits into from
Apr 8, 2022

Conversation

hubipe
Copy link
Contributor

@hubipe hubipe commented Apr 1, 2022

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.

Copy link
Owner

@RikudouSage RikudouSage left a 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.

public function getValidator(): ?ValidatorInterface
{
return new CompoundValidator(
new HungarianIbanValidator($this->account),
Copy link
Owner

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.

Suggested change
new HungarianIbanValidator($this->account),
new HungarianIbanValidator($this),

Comment on lines 18 to 24
private $accountNumber;

public function __construct(string $accountNumber)
{
$this->accountNumber = (string) preg_replace('/[\s\-]+/', '', $accountNumber);
}

Copy link
Owner

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.

Suggested change
private $accountNumber;
public function __construct(string $accountNumber)
{
$this->accountNumber = (string) preg_replace('/[\s\-]+/', '', $accountNumber);
}
private $iban;
public function __construct(HungarianIbanAdapter $iban)
{
$this->iban = $iban;
}

@hubipe
Copy link
Contributor Author

hubipe commented Apr 8, 2022

@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
and the other return statement is deleted.

@RikudouSage
Copy link
Owner

@hubipe
Copy link
Contributor Author

hubipe commented Apr 8, 2022

Now?

@RikudouSage RikudouSage merged commit c130c03 into RikudouSage:master Apr 8, 2022
@RikudouSage
Copy link
Owner

Perfect, thanks!

@hubipe
Copy link
Contributor Author

hubipe commented Apr 8, 2022

Could you please make a release so I could close this PR hubipe/QrPaymentHU#1 ?

@RikudouSage
Copy link
Owner

I did it right after I updated readme.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants