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

Public Functions? #9

Open
felsspat opened this issue May 8, 2017 · 5 comments
Open

Public Functions? #9

felsspat opened this issue May 8, 2017 · 5 comments

Comments

@felsspat
Copy link

felsspat commented May 8, 2017

Hi,

could you please make the functions like calculateSurname() and calculateName() public? The reason is we don't have the belfioreCode or birthday of our Italian customers, but we want to check the rest of the code.

@DavidePastore
Copy link
Owner

Hi @felsspat , this could be a solution but I'd like to have all in this library because I think it's a responsability of it. What I'd prefer is to have a PartialChecker and a PartialCalculator that extends the main Checker and Calculator, to only check/calculate partials of codice fiscale. What do you think of it?
/cc @gadiener

@felsspat
Copy link
Author

Hi @gadiener, thanks for answering!

That would be great too. Since we don't have the place of birth and the birthday of our customers all I'm doing now is a check of the name and the checksum.

$calculator = new Calculator($person);
$nameString = $calculator->calculateSurname() . $calculator->calculateName();

if (substr($taxId, 0, 6) !== $nameString) {
    return false;
}

if ($calculator->calculateCheckDigit(substr($taxId, 0 ,15)) !== $taxId[15]) {
    return false;
}

@DavidePastore
Copy link
Owner

This is related to #10.

@gadiener
Copy link
Contributor

Hi @DavidePastore,

yes, I agree with you. Separating responsibilities by extending the main classes seems to me to be the right approach. I think this should be done in the application domain and not in the library. However we should modify the visibility of those methods to allow their use in subclasses.

What do you think?

@ManuDoni
Copy link

ManuDoni commented Feb 9, 2022

Hello @DavidePastore, I would like to make partial checks as well, can I send a PR making those methods (calculateSurname, calculateName, calculateBirthDateAndGender) at least protected so we can extend the Calculator class?

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

No branches or pull requests

4 participants