Skip to content

Commit

Permalink
slightly improve NicknameMapper
Browse files Browse the repository at this point in the history
  • Loading branch information
wyrfel committed May 26, 2017
1 parent b7f6484 commit d45c6ec
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/Mapper/NicknameMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,19 @@ public function map(array $parts)

if (preg_match('/^[\(\[\<\{]/', $part)) {
$isEncapsulated = true;

$part = substr($part, 1);
}

$addPart = $isEncapsulated;
if (!$isEncapsulated) {
continue;
}

if (preg_match('/[\)\]\>\}]$/', $part)) {
$isEncapsulated = false;
$part = substr($part, 0, -1);
}

if ($addPart) {
$parts[$k] = new Nickname($part);
}
$parts[$k] = new Nickname($part);
}

return $parts;
Expand Down

0 comments on commit d45c6ec

Please sign in to comment.