Skip to content

Commit

Permalink
Applied fixes from StyleCI
Browse files Browse the repository at this point in the history
  • Loading branch information
voku authored and StyleCIBot committed Aug 19, 2015
1 parent 0eff2cf commit f9aea0b
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 37 deletions.
6 changes: 3 additions & 3 deletions src/voku/helper/EmailCheck.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ class EmailCheck
*
* source: http://lxr.php.net/xref/PHP_5_4/ext/filter/logical_filters.c#529
*/
const EMAIL_REGEX_LOCAL = "(?!(?:(?:\\x22?\\x5C[\\x00-\\x7E]\\x22?)|(?:\\x22?[^\\x5C\\x22]\\x22?)){255,})(?!(?:(?:\\x22?\\x5C[\\x00-\\x7E]\\x22?)|(?:\\x22?[^\\x5C\\x22]\\x22?)){65,}@)(?:(?:[\\x21\\x23-\\x27\\x2A\\x2B\\x2D\\x2F-\\x39\\x3D\\x3F\\x5E-\\x7E]+)|(?:\\x22(?:[\\x01-\\x08\\x0B\\x0C\\x0E-\\x1F\\x21\\x23-\\x5B\\x5D-\\x7F]|(?:\\x5C[\\x00-\\x7F]))*\\x22))(?:\\.(?:(?:[\\x21\\x23-\\x27\\x2A\\x2B\\x2D\\x2F-\\x39\\x3D\\x3F\\x5E-\\x7E]+)|(?:\\x22(?:[\\x01-\\x08\\x0B\\x0C\\x0E-\\x1F\\x21\\x23-\\x5B\\x5D-\\x7F]|(?:\\x5C[\\x00-\\x7F]))*\\x22)))*";
const EMAIL_REGEX_DOMAIN = "(?:(?:(?!.*[^.]{64,})(?:(?:(?:xn--)?[öäüa-z0-9]+(?:-[öäüa-z0-9]+)*\\.){1,126}){1,}(?:(?:[öäüa-z][öäüa-z0-9]*)|(?:(?:xn--)[öäüa-z0-9]+))(?:-[öäüa-z0-9]+)*)|(?:\\[(?:(?:IPv6:(?:(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){7})|(?:(?!(?:.*[a-f0-9][:\\]]){7,})(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,5})?::(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,5})?)))|(?:(?:IPv6:(?:(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){5}:)|(?:(?!(?:.*[a-f0-9]:){5,})(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,3})?::(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,3}:)?)))?(?:(?:25[0-5])|(?:2[0-4][0-9])|(?:1[0-9]{2})|(?:[1-9]?[0-9]))(?:\\.(?:(?:25[0-5])|(?:2[0-4][0-9])|(?:1[0-9]{2})|(?:[1-9]?[0-9]))){3}))\\]))";
const EMAIL_REGEX_LOCAL = '(?!(?:(?:\\x22?\\x5C[\\x00-\\x7E]\\x22?)|(?:\\x22?[^\\x5C\\x22]\\x22?)){255,})(?!(?:(?:\\x22?\\x5C[\\x00-\\x7E]\\x22?)|(?:\\x22?[^\\x5C\\x22]\\x22?)){65,}@)(?:(?:[\\x21\\x23-\\x27\\x2A\\x2B\\x2D\\x2F-\\x39\\x3D\\x3F\\x5E-\\x7E]+)|(?:\\x22(?:[\\x01-\\x08\\x0B\\x0C\\x0E-\\x1F\\x21\\x23-\\x5B\\x5D-\\x7F]|(?:\\x5C[\\x00-\\x7F]))*\\x22))(?:\\.(?:(?:[\\x21\\x23-\\x27\\x2A\\x2B\\x2D\\x2F-\\x39\\x3D\\x3F\\x5E-\\x7E]+)|(?:\\x22(?:[\\x01-\\x08\\x0B\\x0C\\x0E-\\x1F\\x21\\x23-\\x5B\\x5D-\\x7F]|(?:\\x5C[\\x00-\\x7F]))*\\x22)))*';
const EMAIL_REGEX_DOMAIN = '(?:(?:(?!.*[^.]{64,})(?:(?:(?:xn--)?[öäüa-z0-9]+(?:-[öäüa-z0-9]+)*\\.){1,126}){1,}(?:(?:[öäüa-z][öäüa-z0-9]*)|(?:(?:xn--)[öäüa-z0-9]+))(?:-[öäüa-z0-9]+)*)|(?:\\[(?:(?:IPv6:(?:(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){7})|(?:(?!(?:.*[a-f0-9][:\\]]){7,})(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,5})?::(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,5})?)))|(?:(?:IPv6:(?:(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){5}:)|(?:(?!(?:.*[a-f0-9]:){5,})(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,3})?::(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,3}:)?)))?(?:(?:25[0-5])|(?:2[0-4][0-9])|(?:1[0-9]{2})|(?:[1-9]?[0-9]))(?:\\.(?:(?:25[0-5])|(?:2[0-4][0-9])|(?:1[0-9]{2})|(?:[1-9]?[0-9]))){3}))\\]))';

public static $domainsExample = array(
'test.de',
Expand Down Expand Up @@ -765,7 +765,7 @@ public static function isValid($email, $useExampleDomainCheck = true, $useTypoIn

} else {

$regEx = "/^(?<local>" . self::EMAIL_REGEX_LOCAL . ")@(?<domain>" . self::EMAIL_REGEX_DOMAIN . ")$/iD";
$regEx = '/^(?<local>' . self::EMAIL_REGEX_LOCAL . ')@(?<domain>' . self::EMAIL_REGEX_DOMAIN . ')$/iD';

if (!preg_match($regEx, $email)) {
return false;
Expand Down
66 changes: 33 additions & 33 deletions tests/EmailCheckTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,41 +43,41 @@ public function testCheckEmail()
'afz@u2qegprqnbf7.com',
'fca05s6e_2@wo2to8g9xxc.com',
'vkqwqlgfrjfna@t-online.de.com',
"first.last@iana.org",
"1234567890123456789012345678901234567890123456789012345678901234@iana.org",
"first.last@3com.com",
"first.last@123.iana.org",
"user+mailbox@iana.org",
"customer/department=shipping@iana.org",
"\$A12345@iana.org",
"!def!xyz%abc@iana.org",
"_somename@iana.org",
"dclo@us.ibm.com",
"first.last@iana.org",
"test@iana.org",
"TEST@iana.org",
"1234567890@iana.org",
"test+test@iana.org",
"test-test@iana.org",
"t*est@iana.org",
"+1~1+@iana.org",
"{_test_}@iana.org",
"test.test@iana.org",
"test@example.iana.org",
"test@example.example.iana.org",
"customer/department@iana.org",
"_Lall.Sam@iana.org",
"~@iana.org",
"a@bar.com",
"a-b@bar.com",
"+@b.com",
"a@b.co-foo.uk",
"valid@about.museum",
'first.last@iana.org',
'1234567890123456789012345678901234567890123456789012345678901234@iana.org',
'first.last@3com.com',
'first.last@123.iana.org',
'user+mailbox@iana.org',
'customer/department=shipping@iana.org',
'$A12345@iana.org',
'!def!xyz%abc@iana.org',
'_somename@iana.org',
'dclo@us.ibm.com',
'first.last@iana.org',
'test@iana.org',
'TEST@iana.org',
'1234567890@iana.org',
'test+test@iana.org',
'test-test@iana.org',
't*est@iana.org',
'+1~1+@iana.org',
'{_test_}@iana.org',
'test.test@iana.org',
'test@example.iana.org',
'test@example.example.iana.org',
'customer/department@iana.org',
'_Lall.Sam@iana.org',
'~@iana.org',
'a@bar.com',
'a-b@bar.com',
'+@b.com',
'a@b.co-foo.uk',
'valid@about.museum',
//"foobar@192.168.0.1",
"user%uucp!path@berkeley.edu",
'user%uucp!path@berkeley.edu',
"cdburgess+!#$%&'*-/=?+_{}|~test@gmail.com",
"test@xn--example.com",
"foobar.66540@web.de",
'test@xn--example.com',
'foobar.66540@web.de',
);

$testArrayFail = array(
Expand Down
2 changes: 1 addition & 1 deletion tests/bootstrap.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<?php

require_once dirname(__DIR__) . '/vendor/autoload.php';
require_once dirname(__DIR__) . '/vendor/autoload.php';

0 comments on commit f9aea0b

Please sign in to comment.