diff --git a/src/Emails/EditableEmail.php b/src/Emails/EditableEmail.php index cb223bd..e013cdd 100644 --- a/src/Emails/EditableEmail.php +++ b/src/Emails/EditableEmail.php @@ -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; diff --git a/src/Services/YandexRu.php b/src/Services/YandexRu.php index 20ffcf3..b883cab 100644 --- a/src/Services/YandexRu.php +++ b/src/Services/YandexRu.php @@ -13,6 +13,7 @@ class YandexRu implements ServiceInterface { return (new EditableEmail($email)) ->removeSuffixAlias('+') + ->replaceInLocalPart('.', '-') ->lowerCaseLocalPartIf(true) ->setDomain($this->mapDomain($email->getDomain())); } diff --git a/tests/Services/YandexRuTest.php b/tests/Services/YandexRuTest.php index e41b495..1dadce0 100644 --- a/tests/Services/YandexRuTest.php +++ b/tests/Services/YandexRuTest.php @@ -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'], ]; }