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

Enhancement for company names, titles and lastname extensions #40

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ This parser is able to handle name patterns with and without comma:
```
... [lastname] ..., ... [firstname] ..., [suffix]
```
Without a comma, the string is first compared against identifiers for company names (Ltd., Inc. etc). If so the whole string will be returned as a company name.

### Supported parts
- salutations (e.g. Mr, Mrs, Dr, etc.)
Expand All @@ -49,6 +50,8 @@ This parser is able to handle name patterns with and without comma:
- nicknames (parts within parenthesis, brackets etc.)
- last names (also supports prefixes like von, de etc.)
- suffixes (Jr, Senior, 3rd, PhD, etc.)
- titles (academic titles like Dr. med., Dr.h.c. etc)
- lastname extensions (nobility predicates like Gräfin, Baron)

### Other features
- multi-language support for salutations, suffixes and lastname prefixes
Expand Down Expand Up @@ -77,13 +80,16 @@ $parser = new TheIconic\NameParser\Parser();

$name = $parser->parse($input);

echo $name->getCompany();
echo $name->getSalutation();
echo $name->getFirstname();
echo $name->getLastname();
echo $name->getMiddlename();
echo $name->getNickname();
echo $name->getInitials();
echo $name->getSuffix();
echo $name->getTitle();
echo $name->getExtension();

print_r($name->getAll());

Expand Down
4 changes: 4 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
parameters:
inferPrivatePropertyTypeFromConstructor: true
ignoreErrors:
- '#Array has [0-9] duplicate keys with value *#'
19 changes: 19 additions & 0 deletions src/Language/English.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,23 @@ public function getLastnamePrefixes(): array
{
return self::LASTNAME_PREFIXES;
}

// see German for further information
public function getExtensions(): array
{
return [];
}

// see German for further information
public function getTitles(): array
{
return [];
}

// see German for further information
public function getCompanies(): array
{
return [];
}
}

Loading