From 60112680494e6d7be5d85412f258bae94901be2d Mon Sep 17 00:00:00 2001 From: bkrukowski Date: Sat, 10 Sep 2016 15:13:55 +0200 Subject: [PATCH] Rename to TransparentEmail --- README.md | 8 +-- composer.json | 6 +-- phpunit.xml.dist | 2 +- src/InvalidEmailException.php | 2 +- src/Services/GmailCom.php | 2 +- src/Services/MultiDomain.php | 2 +- src/Services/OutlookCom.php | 2 +- src/Services/ServiceInterface.php | 2 +- src/Services/TlenPl.php | 2 +- src/Services/Www33MailCom.php | 2 +- src/Services/YahooCom.php | 2 +- src/{Gordianus.php => TransparentEmail.php} | 16 +++--- tests/GordianusTest.php | 56 --------------------- tests/Services/GmailComTest.php | 4 +- tests/Services/MultiDomainTest.php | 4 +- tests/Services/OutlookComTest.php | 4 +- tests/Services/Www33MailComTest.php | 4 +- tests/Services/YahooComTest.php | 4 +- tests/TransparentEmailTest.php | 56 +++++++++++++++++++++ 19 files changed, 90 insertions(+), 90 deletions(-) rename src/{Gordianus.php => TransparentEmail.php} (82%) delete mode 100644 tests/GordianusTest.php create mode 100644 tests/TransparentEmailTest.php diff --git a/README.md b/README.md index 9dc42c5..a72687e 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,9 @@ [![Coverage Status](https://coveralls.io/repos/github/bkrukowski/gordianus/badge.svg?branch=master)](https://coveralls.io/github/bkrukowski/gordianus?branch=master) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/b057fa037a3b4f318f75af27b0b01d47)](https://www.codacy.com/app/bartlomiej-krukowski/gordianus?utm_source=github.com&utm_medium=referral&utm_content=bkrukowski/gordianus&utm_campaign=Badge_Grade) -# Gordianus +# Transparent Email -Gordianus clears aliases from email address. Email `John.Doe+alias@gmail.com` will be transformed to `johndoe@gmail.com`. +Transparent Email clears aliases from email address. Email `John.Doe+alias@gmail.com` will be transformed to `johndoe@gmail.com`. ## Why? @@ -21,8 +21,8 @@ To detect multi-accounts on your website. ## Usage ```php -$gordianus = new \bkrukowski\Gordianus\Gordianus(); -$transformedEmail = $gordianus->getPrimaryEmail('John.Doe+alias@gmail.com'); +$cleaner = new \bkrukowski\TransparentEmail\TransparentEmail(); +$transformedEmail = $cleaner->getPrimaryEmail('John.Doe+alias@gmail.com'); ``` ## Yahoo.com diff --git a/composer.json b/composer.json index a3e3faa..d588f37 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,5 @@ { - "name": "bkrukowski/gordianus", + "name": "bkrukowski/transparent-email", "description": "Remove aliases from email and get primary email account", "type": "library", "require": { @@ -19,12 +19,12 @@ ], "autoload": { "psr-4": { - "bkrukowski\\Gordianus\\": "src/" + "bkrukowski\\TransparentEmail\\": "src/" } }, "autoload-dev": { "psr-4": { - "bkrukowski\\Gordianus\\Tests\\": "tests/" + "bkrukowski\\TransparentEmail\\Tests\\": "tests/" } } } diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 886ebf4..8a7d274 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -8,7 +8,7 @@ > - + tests diff --git a/src/InvalidEmailException.php b/src/InvalidEmailException.php index 68f36cb..fe48abd 100644 --- a/src/InvalidEmailException.php +++ b/src/InvalidEmailException.php @@ -1,6 +1,6 @@ expectException(InvalidEmailException::class); - } - (new Gordianus())->getPrimaryEmail($email); - } - - public function providerValidator() - { - return [ - ['john.doe@gmail.comm', true], - ['john doe@gmail.com', false], - ]; - } - - /** - * @dataProvider providerGetPrimaryEmail - * - * @param Gordianus $gordianus - * @param string $email - * @param string $expectedEmail - */ - public function testGetPrimaryEmail(Gordianus $gordianus, string $email, string $expectedEmail) - { - $this->assertSame($expectedEmail, $gordianus->getPrimaryEmail($email)); - } - - public function providerGetPrimaryEmail() - { - return [ - [new Gordianus([Gordianus::SERVICE_TLEN_PL]), 'john.doe+alias@gmail.com', 'john.doe+alias@gmail.com'], - [new Gordianus(), 'john.doe+alias@gmail.com', 'johndoe@gmail.com'], - [new Gordianus([]), 'John.Doe@example.com', 'john.doe@example.com'], - [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@yahoo.com'], - ]; - } -} \ No newline at end of file diff --git a/tests/Services/GmailComTest.php b/tests/Services/GmailComTest.php index 2771071..7ee1ea6 100644 --- a/tests/Services/GmailComTest.php +++ b/tests/Services/GmailComTest.php @@ -1,8 +1,8 @@ expectException(InvalidEmailException::class); + } + (new TransparentEmail())->getPrimaryEmail($email); + } + + public function providerValidator() + { + return [ + ['john.doe@gmail.comm', true], + ['john doe@gmail.com', false], + ]; + } + + /** + * @dataProvider providerGetPrimaryEmail + * + * @param TransparentEmail $TransparentEmail + * @param string $email + * @param string $expectedEmail + */ + public function testGetPrimaryEmail(TransparentEmail $TransparentEmail, string $email, string $expectedEmail) + { + $this->assertSame($expectedEmail, $TransparentEmail->getPrimaryEmail($email)); + } + + public function providerGetPrimaryEmail() + { + return [ + [new TransparentEmail([TransparentEmail::SERVICE_TLEN_PL]), 'john.doe+alias@gmail.com', 'john.doe+alias@gmail.com'], + [new TransparentEmail(), 'john.doe+alias@gmail.com', 'johndoe@gmail.com'], + [new TransparentEmail([]), 'John.Doe@example.com', 'john.doe@example.com'], + [new TransparentEmail([], true), 'John.Doe@example.com', 'John.Doe@example.com'], + [new TransparentEmail(TransparentEmail::ALL_SERVICES, true), 'John.Doe@gmail.com', 'johndoe@gmail.com'], + [new TransparentEmail(), 'Jane.Doe+receipts@hotmail.com', 'jane.doe@hotmail.com'], + [new TransparentEmail(), 'Jane.Doe-receipts@yahoo.com', 'jane.doe@yahoo.com'], + ]; + } +} \ No newline at end of file