protected function mapParts(array $parts): array
    {
        $k = $this->skipIgnoredParts($parts) + 1;
        $remapIgnored = true;

        while (--$k >= 0) {
            $part = $parts[$k];

            if ($part instanceof AbstractPart) {
                break;
            }

            if ($this->isFollowedByLastnamePart($parts, $k)) {
                if ($this->isApplicablePrefix($parts, $k)) {
                    $parts[$k] = new LastnamePrefix($part, $this->prefixes[$this->getKey($part)]);
                    continue;
                }

                if ($this->shouldStopMapping($parts, $k)) {
                    break;
                }
            }

            $parts[$k] = new Lastname($part);
            $remapIgnored = false;
        }

        if ($remapIgnored) {
            $parts = $this->remapIgnored($parts);
        }

        return $parts;
    }
protected function mapParts(array $parts): array
    {
        $k = $this->skipIgnoredParts($parts) + 1;
        $remapIgnored = true;

        while (--$k >= 0) {
            $part = $parts[$k];

            if ($part instanceof AbstractPart) {
                break;
            }

            if ($this->isFollowedByLastnamePart($parts, $k)) {
                if ($this->isApplicablePrefix($parts, $k)) {
                    $parts[$k] = new LastnamePrefix($part, $this->prefixes[$this->getKey($part)]);
                    continue;
                }

                if ($this->shouldStopMapping($parts, $k)) {
                    break;
                }
            }

            $parts[$k] = new Lastname($part);
            $remapIgnored = false;
        }

        if ($remapIgnored) {
            $parts = $this->remapIgnored($parts);
        }

        return $parts;
    }
protected function mapParts ( array $ parts ) : array { $ k = $ this -> skipIgnoredParts ( $ parts ) + 1 ; $ remapIgnored = true ; while ( -- $ k >= 0 ) { $ part = $ parts [ $ k ] ; if ( $ part instanceof AbstractPart ) { break ; } if ( $ this -> isFollowedByLastnamePart ( $ parts , $ k ) ) { if ( $ this -> isApplicablePrefix ( $ parts , $ k ) ) { $ parts [ $ k ] = new LastnamePrefix ( $ part , $ this -> prefixes [ $ this -> getKey ( $ part ) ] ) ; continue ; } if ( $ this -> shouldStopMapping ( $ parts , $ k ) ) { break ; } } $ parts [ $ k ] = new Lastname ( $ part ) ; $ remapIgnored = false ; } if ( $ remapIgnored ) { $ parts = $ this -> remapIgnored ( $ parts ) ; } return $ parts ; }
we map the parts in reverse order because it makes more
sense to parse for the lastname starting from the end

@param array $parts
@return array
we map the parts in reverse order because it makes more sense to parse for the lastname starting from the end