mirror of
https://github.com/egulias/EmailValidator.git
synced 2026-09-04 14:38:21 +00:00
Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d42c8731f0 | |||
| 515346048d | |||
| 4fc3f5c419 | |||
| 7dc3b8de4c | |||
| 3bd9c8c802 | |||
| 8be1dae097 | |||
| dcf8f79c41 | |||
| e30356b45e | |||
| 229560066e |
@@ -8,12 +8,26 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
upload:
|
upload:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
if: >
|
||||||
|
github.event.workflow_run.event == 'pull_request' &&
|
||||||
|
github.event.workflow_run.conclusion == 'success'
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: true
|
fail-fast: true
|
||||||
name: upload-coverage
|
name: upload-coverage
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
- name: Setup logs directory
|
||||||
|
run: mkdir -p build/coverage
|
||||||
|
- name: Download clover.xml artifact
|
||||||
|
uses: dawidd6/action-download-artifact@v7
|
||||||
|
with:
|
||||||
|
workflow: tests.yml
|
||||||
|
name: clover.xml
|
||||||
|
path: build/coverage
|
||||||
|
|
||||||
- name: Upload Coverage to Codacy
|
- name: Upload Coverage to Codacy
|
||||||
shell: bash
|
shell: bash
|
||||||
env:
|
env:
|
||||||
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}
|
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}
|
||||||
run: bash <(curl -Ls https://coverage.codacy.com/get.sh) report -r build/logs/clover.xml
|
|
||||||
|
run: bash <(curl -Ls https://coverage.codacy.com/get.sh) report -r build/coverage/clover.xml
|
||||||
@@ -34,7 +34,7 @@ This library aims to support RFCs:
|
|||||||
* [Spoofchecking](/src/Validation/Extra/SpoofCheckValidation.php) and
|
* [Spoofchecking](/src/Validation/Extra/SpoofCheckValidation.php) and
|
||||||
[DNSCheckValidation](/src/Validation/DNSCheckValidation.php) validation
|
[DNSCheckValidation](/src/Validation/DNSCheckValidation.php) validation
|
||||||
requires that your PHP system has the
|
requires that your PHP system has the
|
||||||
[PHP Internationalization Libraries](https://php.net/manual/en/book.intl.php)
|
[PHP Internationalization Libraries](https://php.net/manual/en/book.intl.php)
|
||||||
(also known as PHP Intl)
|
(also known as PHP Intl)
|
||||||
|
|
||||||
**Note**: `PHP version upgrades will happen to accomodate to the pace of major
|
**Note**: `PHP version upgrades will happen to accomodate to the pace of major
|
||||||
@@ -109,7 +109,6 @@ Validations not present in the RFCs
|
|||||||
1. [SpoofCheckValidation](/src/Validation/Extra/SpoofCheckValidation.php):
|
1. [SpoofCheckValidation](/src/Validation/Extra/SpoofCheckValidation.php):
|
||||||
Will check for multi-utf-8 chars that can signal an erroneous email name.
|
Will check for multi-utf-8 chars that can signal an erroneous email name.
|
||||||
|
|
||||||
|
|
||||||
### How to extend
|
### How to extend
|
||||||
|
|
||||||
It's easy! You just need to implement
|
It's easy! You just need to implement
|
||||||
@@ -126,7 +125,8 @@ Is short and simple and will help a lot.
|
|||||||
(You can find current contributors
|
(You can find current contributors
|
||||||
[here](https://github.com/egulias/EmailValidator/graphs/contributors))
|
[here](https://github.com/egulias/EmailValidator/graphs/contributors))
|
||||||
|
|
||||||
As this is a port from another library and work, here are other people related to the previous one:
|
As this is a port from another library and work, here are other people related
|
||||||
|
to the previous one:
|
||||||
|
|
||||||
* Ricard Clau [@ricardclau](https://github.com/ricardclau):
|
* Ricard Clau [@ricardclau](https://github.com/ricardclau):
|
||||||
Performance against PHP built-in filter_var (v2 and earlier)
|
Performance against PHP built-in filter_var (v2 and earlier)
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ class LocalPart extends PartParser
|
|||||||
|
|
||||||
public function parse(): Result
|
public function parse(): Result
|
||||||
{
|
{
|
||||||
|
$this->lexer->clearRecorded();
|
||||||
$this->lexer->startRecording();
|
$this->lexer->startRecording();
|
||||||
|
|
||||||
while (!$this->lexer->current->isA(EmailLexer::S_AT) && !$this->lexer->current->isA(EmailLexer::S_EMPTY)) {
|
while (!$this->lexer->current->isA(EmailLexer::S_AT) && !$this->lexer->current->isA(EmailLexer::S_EMPTY)) {
|
||||||
|
|||||||
@@ -11,6 +11,6 @@ class NoDNSRecord implements Reason
|
|||||||
|
|
||||||
public function description() : string
|
public function description() : string
|
||||||
{
|
{
|
||||||
return 'No MX or A DSN record was found for this email';
|
return 'No MX or A DNS record was found for this email';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,22 +6,26 @@ interface Result
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Is validation result valid?
|
* Is validation result valid?
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
public function isValid() : bool;
|
public function isValid(): bool;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is validation result invalid?
|
* Is validation result invalid?
|
||||||
* Usually the inverse of isValid()
|
* Usually the inverse of isValid()
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
public function isInvalid() : bool;
|
public function isInvalid(): bool;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Short description of the result, human readable.
|
* Short description of the result, human readable.
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
public function description() : string;
|
public function description(): string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Code for user land to act upon.
|
* Code for user land to act upon.
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
public function code() : int;
|
public function code(): int;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,4 +28,18 @@ class EmailParserTest extends TestCase
|
|||||||
$this->assertEquals($local, $parser->getLocalPart());
|
$this->assertEquals($local, $parser->getLocalPart());
|
||||||
$this->assertEquals($domain, $parser->getDomainPart());
|
$this->assertEquals($domain, $parser->getDomainPart());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testMultipleEmailAddresses()
|
||||||
|
{
|
||||||
|
$parser = new EmailParser(new EmailLexer());
|
||||||
|
$parser->parse('some-local-part@some-random-but-large-domain-part.example.com');
|
||||||
|
|
||||||
|
$this->assertSame('some-local-part', $parser->getLocalPart());
|
||||||
|
$this->assertSame('some-random-but-large-domain-part.example.com', $parser->getDomainPart());
|
||||||
|
|
||||||
|
$parser->parse('another-local-part@another.example.com');
|
||||||
|
|
||||||
|
$this->assertSame('another-local-part', $parser->getLocalPart());
|
||||||
|
$this->assertSame('another.example.com', $parser->getDomainPart());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user