mirror of
https://github.com/retailcrm/transparent-email.git
synced 2024-11-21 21:06:04 +03:00
Add Yandex.ru replacement dots for dashes
This commit is contained in:
parent
2b41d9fe15
commit
ed8a560b00
@ -25,6 +25,14 @@ class EditableEmail implements EmailInterface
|
|||||||
return $copy;
|
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
|
public function removeSuffixAlias(string $delimiter) : EditableEmail
|
||||||
{
|
{
|
||||||
$copy = clone $this;
|
$copy = clone $this;
|
||||||
|
@ -13,6 +13,7 @@ class YandexRu implements ServiceInterface
|
|||||||
{
|
{
|
||||||
return (new EditableEmail($email))
|
return (new EditableEmail($email))
|
||||||
->removeSuffixAlias('+')
|
->removeSuffixAlias('+')
|
||||||
|
->replaceInLocalPart('.', '-')
|
||||||
->lowerCaseLocalPartIf(true)
|
->lowerCaseLocalPartIf(true)
|
||||||
->setDomain($this->mapDomain($email->getDomain()));
|
->setDomain($this->mapDomain($email->getDomain()));
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,7 @@ class YandexRuTest extends TestCase
|
|||||||
['fOObar@YAndEX.ru', 'foobar@yandex.ru'],
|
['fOObar@YAndEX.ru', 'foobar@yandex.ru'],
|
||||||
['foobar+alias@yandex.ru', 'foobar@yandex.ru'],
|
['foobar+alias@yandex.ru', 'foobar@yandex.ru'],
|
||||||
['JaneDoe@ya.ru', 'janedoe@yandex.ru'],
|
['JaneDoe@ya.ru', 'janedoe@yandex.ru'],
|
||||||
|
['Jane.Doe@ya.ru', 'jane-doe@yandex.ru'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user