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

Partial check #64

Open
Polm90 opened this issue Jan 19, 2023 · 3 comments
Open

Partial check #64

Polm90 opened this issue Jan 19, 2023 · 3 comments

Comments

@Polm90
Copy link

Polm90 commented Jan 19, 2023

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!

@DavidePastore
Copy link
Owner

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.👍

@darnel
Copy link

darnel commented Mar 23, 2023

@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?

@Polm90
Copy link
Author

Polm90 commented Mar 23, 2023

Perfect, thank you!

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

3 participants