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

[Feature request] Be able to access the lastname prefix + lastname separately #10

Closed
divinenanny opened this issue Jul 13, 2018 · 2 comments

Comments

@divinenanny
Copy link

I really like how the name-parser can recognise the lastname prefix correctly. Now I would like to be able to get this prefix and the lastname separately.
This could be a setting (maybe related to the language setting, where in Dutch the lastname prefix is a separate part of the name (and for example sorting goes by last name, without the prefix).)

Example:

Frank van Delft (Dutch name), is recognised as:

TheIconic\NameParser\Name Object
(
    [parts:protected] => Array
        (
            [0] => TheIconic\NameParser\Part\Firstname Object
                (
                    [value:protected] => Frank
                )

            [1] => TheIconic\NameParser\Part\LastnamePrefix Object
                (
                    [normalized:protected] => van
                    [value:protected] => Van
                )

            [2] => TheIconic\NameParser\Part\Lastname Object
                (
                    [value:protected] => Delft
                )

        )

)

Doing:

echo $name->getFirstname() . "\n";
echo $name->getLastnamePrefix() . "\n";
echo $name->getLastname() . "\n";

Gives:

Frank
van
Delft
@wyrfel
Copy link
Contributor

wyrfel commented Aug 28, 2018

Hi @divinenanny. Sounds like a reasonable change. Would you be game to create a PR for this yourself?

@wyrfel
Copy link
Contributor

wyrfel commented Aug 28, 2018

Actually just implemented it in #13.

@wyrfel wyrfel closed this as completed in 902d146 Aug 28, 2018
wyrfel added a commit that referenced this issue Aug 28, 2018
…x-getter

Allow separate retrieval of lastname and lastname prefixes (fixes #10)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants