jasonpriem/HumanNameParser.php

Cases with a single name throws an exception

Opened this issue · 1 comments

Hi,

So I tried using your library to parse customer names coming in from an online ordering system.

Some names tend to just be one word, like "Henry". Your library throws an exception and halts execution if I try to get a last name from cases where there is only a single word. Why not just return ""? Or maybe an option for how strict it should be when returning name parts?

Like
level 1, halt for all missing pieces
level 2, just return empty string for missing pieces with no errors

I created a pull request to deal with this issue, not sure if it's the correct approach or if it's even something you'd be interested in @jasonpriem Feel free to review and let me know if you'd like me to change anything. PR is here for reference: #12