Open Polm90 opened 1 year ago
Hi @Polm90. Unfortunately, it's not possible to partially check a codice fiscale with this package. If you are interested in the project, feel free to submit a PR for it.👍
@Polm90 I set up the Subject with name and surname and fills the rest with fictional values. Then checking 6 characters of calculated value with user input:
$calculator = new Calculator(
new Subject(
[
'name' => $name,
'surname' => $surname,
// fake data to make calculator work
'birthDate' => new \DateTimeImmutable('1980-01-01'),
'gender' => 'M',
'belfioreCode' => 'D641', // Fobello (VC)
]),
['omocodiaAllowed' => true]
);
$calculated = $calculator->calculate();
// compare first 6 characters only
return substr($cf, 0, 6) === substr($calculated, 0, 6);
Is that what you need?
Perfect, thank you!
Is it possibile to check if only a part of the codice fiscale is valid? For example, only the name - surname part and/or the lettera di controllo part?
Thank you!