Skip to content

Commit

Permalink
more test; still need to make them work
Browse files Browse the repository at this point in the history
  • Loading branch information
wyrfel committed May 8, 2015
1 parent 062eff0 commit 6c7e20b
Show file tree
Hide file tree
Showing 2 changed files with 455 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/Mapper/FirstnameMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,24 @@ public function map($parts) {
return $parts;
}

foreach ($parts as $k => $part) {
if ($part instanceof Salutation) {
continue;
// skip to after salutation
$length = count($parts);
$start = 0;
for ($i = 0; $i < $length; $i++) {
if ($parts[$i] instanceof Salutation) {
$start = $i + 1;
}
}

for ($k = $start; $k < $length; $k++) {
$part = $parts[$k];

if ($part instanceof Lastname) {
break;
}

if ($part instanceof Initial) {
if ($parts[$k-1] instanceof Firstname || $parts[$k-1] instanceof Initial) {
if (!isset($parts[$k-1]) || $parts[$k-1] instanceof Firstname || $parts[$k-1] instanceof Initial) {
continue;
}

Expand Down
Loading

0 comments on commit 6c7e20b

Please sign in to comment.