From cbaf1222899765caf02e4f53a86d46d34dcb5bb5 Mon Sep 17 00:00:00 2001 From: bkrukowski Date: Sat, 10 Sep 2016 14:45:30 +0200 Subject: [PATCH] Support for yahoo.com --- README.md | 3 ++- src/Services/YahooCom.php | 3 +-- tests/GordianusTest.php | 2 +- tests/Services/YahooComTest.php | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index cc3843e..9dc42c5 100644 --- a/README.md +++ b/README.md @@ -37,4 +37,5 @@ Yahoo uses the following pattern[*](https://help.yahoo.com/kb/SLN16026.html): * *baseName* - value defined by the user, different than email login; * *keyword* - one from a list of keywords defined by the user. -Therefore we do not know what is the real email, so in this case result will be `baseName-alias@yahoo.com`. \ No newline at end of file +Therefore we do not know what is the real email, so in this case result will be `baseName@yahoo.com`, +which actually does not exist. \ No newline at end of file diff --git a/src/Services/YahooCom.php b/src/Services/YahooCom.php index 2de6cfe..e3cead9 100644 --- a/src/Services/YahooCom.php +++ b/src/Services/YahooCom.php @@ -10,9 +10,8 @@ class YahooCom implements ServiceInterface public function getPrimaryEmail(string $email) : string { list($name, $domain) = explode('@', strtolower($email)); - $explodedName = explode('-', $name, 2); - return $explodedName[0] . (count($explodedName) === 2 ? '-alias' : '') . '@' . $domain; + return explode('-', $name, 2)[0] . '@' . $domain; } public function isDomainSupported(string $domain) : bool diff --git a/tests/GordianusTest.php b/tests/GordianusTest.php index 8d5a195..e71d554 100644 --- a/tests/GordianusTest.php +++ b/tests/GordianusTest.php @@ -50,7 +50,7 @@ class GordianusTest extends \PHPUnit_Framework_TestCase [new Gordianus([], true), 'John.Doe@example.com', 'John.Doe@example.com'], [new Gordianus(Gordianus::ALL_SERVICES, true), 'John.Doe@gmail.com', 'johndoe@gmail.com'], [new Gordianus(), 'Jane.Doe+receipts@hotmail.com', 'jane.doe@hotmail.com'], - [new Gordianus(), 'Jane.Doe-receipts@yahoo.com', 'jane.doe-alias@yahoo.com'], + [new Gordianus(), 'Jane.Doe-receipts@yahoo.com', 'jane.doe@yahoo.com'], ]; } } \ No newline at end of file diff --git a/tests/Services/YahooComTest.php b/tests/Services/YahooComTest.php index e874a7f..77d6407 100644 --- a/tests/Services/YahooComTest.php +++ b/tests/Services/YahooComTest.php @@ -48,8 +48,8 @@ class YahooComTest extends \PHPUnit_Framework_TestCase ['jane.doe@yahoo.com', 'jane.doe@yahoo.com'], ['Jane.Doe@Yahoo.Com', 'jane.doe@yahoo.com'], ['Jane.Doe+receipts@YAHOO.COM', 'jane.doe+receipts@yahoo.com'], - ['Jane.Doe-receipts@YAHOO.COM', 'jane.doe-alias@yahoo.com'], - ['Jane.Doe-spam-alias@YAHOO.COM', 'jane.doe-alias@yahoo.com'], + ['Jane.Doe-receipts@YAHOO.COM', 'jane.doe@yahoo.com'], + ['Jane.Doe-spam-alias@YAHOO.COM', 'jane.doe@yahoo.com'], ]; } } \ No newline at end of file