Conditions | 2 |
Paths | 2 |
Total Lines | 26 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
28 | public function isValid($email, EmailValidation $emailValidation) |
||
29 | { |
||
30 | $wsp = '[\x20\x09]'; |
||
31 | $vchar = '[\x21-\x7e]'; |
||
32 | $quoted_pair = "\\\\(?:$vchar|$wsp)"; |
||
33 | $qtext = '[\x21\x23-\x5b\x5d-\x7e]'; |
||
34 | $qcontent = "(?:$qtext|$quoted_pair)"; |
||
35 | $quoted_string = "\"$qcontent*\""; |
||
36 | $atext = '[a-zA-Z0-9!#$%&\'*+\-\/\=?^_`{|}~]'; |
||
37 | $dot_atom = "$atext+(?:[.]$atext+)*"; |
||
38 | $local_part = "(?:$dot_atom|$quoted_string)"; |
||
39 | $domain = $dot_atom; |
||
40 | $addr_spec = "{$local_part}[@]$domain"; |
||
|
|||
41 | $dot_atom_loose = "$atext+(?:[.]|$atext)*"; |
||
42 | $local_part_loose = "(?:$dot_atom_loose|$quoted_string)"; |
||
43 | $addr_spec_loose = "{$local_part_loose}[@]$domain"; |
||
44 | |||
45 | // 携帯メールアドレス用に、..や.@を許容する。 |
||
46 | $regexp = "/\A{$addr_spec_loose}\z/"; |
||
47 | |||
48 | if (preg_match($regexp, $email)) { |
||
49 | return true; |
||
50 | } |
||
51 | |||
52 | return false; |
||
53 | } |
||
54 | } |
||
55 |
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVar
assignment in line 1 and the$higher
assignment in line 2 are dead. The first because$myVar
is never used and the second because$higher
is always overwritten for every possible time line.