| Conditions | 2 |
| Paths | 2 |
| Total Lines | 24 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 27 | public function isValid($email, EmailValidation $emailValidation) |
||
| 28 | { |
||
| 29 | $wsp = '[\x20\x09]'; |
||
| 30 | $vchar = '[\x21-\x7e]'; |
||
| 31 | $quoted_pair = "\\\\(?:$vchar|$wsp)"; |
||
| 32 | $qtext = '[\x21\x23-\x5b\x5d-\x7e]'; |
||
| 33 | $qcontent = "(?:$qtext|$quoted_pair)"; |
||
| 34 | $quoted_string = "\"$qcontent*\""; |
||
| 35 | $atext = '[a-zA-Z0-9!#$%&\'*+\-\/\=?^_`{|}~]'; |
||
| 36 | $dot_atom = "$atext+(?:[.]$atext+)*"; |
||
| 37 | $domain = $dot_atom; |
||
| 38 | $dot_atom_loose = "$atext+(?:[.]|$atext)*"; |
||
| 39 | $local_part_loose = "(?:$dot_atom_loose|$quoted_string)"; |
||
| 40 | $addr_spec_loose = "{$local_part_loose}[@]$domain"; |
||
| 41 | |||
| 42 | // 携帯メールアドレス用に、..や.@を許容する。 |
||
| 43 | $regexp = "/\A{$addr_spec_loose}\z/"; |
||
| 44 | |||
| 45 | if (preg_match($regexp, $email)) { |
||
| 46 | return true; |
||
| 47 | } |
||
| 48 | |||
| 49 | return false; |
||
| 50 | } |
||
| 51 | } |
||
| 52 |