Skip to content

Commit

Permalink
Improve email searching
Browse files Browse the repository at this point in the history
  • Loading branch information
bajb committed Jun 27, 2018
1 parent 06e11dc commit 0bcd114
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/EmailAddress.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ protected function _calculateName()
$firstCommon = Strings::commonPrefix($first, $this->_fullName);
$comLen = strlen($firstCommon);
$matchStart = strtolower(substr($this->_providedName[0], 0, $comLen)) != $firstCommon;
if($comLen > 2)
if($comLen > 1)
{
if($matchStart || strtolower(str_replace(' ', '', $this->_fullName)) == $first)
{
Expand Down
18 changes: 17 additions & 1 deletion tests/EmailAddressTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,22 @@ public function emailProvider()
],
['Melanierichards', '', 'Melanierichards'],
],
[
'[email protected]',
[
'firstName' => 'Peter',
'lastName' => 'Newell',
],
['Peter', '', 'Newell'],
],
[
'[email protected]',
[
'firstName' => 'Etay',
'lastName' => 'Taylor',
],
['Etay', '', 'Etay'],
],
[
'[email protected]',
[
Expand Down Expand Up @@ -253,7 +269,7 @@ public function emailProvider()
['Ginny', '', ''],
],
[
'dennisnesbitt@telkodsa.net',
'dennisnesbitt@sdgsdgsd.net',
[
'firstName' => "Dennis",
'middleName' => "B",
Expand Down

0 comments on commit 0bcd114

Please sign in to comment.