mirror of
https://github.com/retailcrm/transparent-email.git
synced 2025-03-29 11:49:58 +03:00
Add Yandex.ru replacement dots for dashes
This commit is contained in:
parent
2b41d9fe15
commit
ed8a560b00
3 changed files with 10 additions and 0 deletions
|
@ -25,6 +25,14 @@ class EditableEmail implements EmailInterface
|
|||
return $copy;
|
||||
}
|
||||
|
||||
public function replaceInLocalPart(string $toReplace, string $replacement) : EditableEmail
|
||||
{
|
||||
$copy = clone $this;
|
||||
$copy->localPart = str_replace($toReplace, $replacement, $this->localPart);
|
||||
|
||||
return $copy;
|
||||
}
|
||||
|
||||
public function removeSuffixAlias(string $delimiter) : EditableEmail
|
||||
{
|
||||
$copy = clone $this;
|
||||
|
|
|
@ -13,6 +13,7 @@ class YandexRu implements ServiceInterface
|
|||
{
|
||||
return (new EditableEmail($email))
|
||||
->removeSuffixAlias('+')
|
||||
->replaceInLocalPart('.', '-')
|
||||
->lowerCaseLocalPartIf(true)
|
||||
->setDomain($this->mapDomain($email->getDomain()));
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@ class YandexRuTest extends TestCase
|
|||
['fOObar@YAndEX.ru', 'foobar@yandex.ru'],
|
||||
['foobar+alias@yandex.ru', 'foobar@yandex.ru'],
|
||||
['JaneDoe@ya.ru', 'janedoe@yandex.ru'],
|
||||
['Jane.Doe@ya.ru', 'jane-doe@yandex.ru'],
|
||||
];
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue