Conditions | 2 |
Paths | 2 |
Total Lines | 25 |
Lines | 0 |
Ratio | 0 % |
Tests | 14 |
CRAP Score | 2.0011 |
Changes | 0 |
1 | <?php |
||
16 | 1 | public function getDefinition($name) |
|
17 | { |
||
18 | 1 | switch ($name) { |
|
19 | case 'addr-spec': |
||
20 | /** @noinspection PhpUnhandledExceptionInspection */ |
||
21 | 1 | $spec = parent::getDefinition($name); |
|
22 | $fuzzy_domains = array( |
||
23 | 1 | 'docomo\.ne\.jp', |
|
24 | 'ezweb\.ne\.jp', |
||
25 | ); |
||
26 | 1 | $atext = $this->getDefinition('atext'); |
|
27 | 1 | $CFWS = $this->getDefinition('CFWS'); |
|
28 | 1 | $invalid_dot_atom_text = '(?:\.*'. $atext. '+'. '(\.+'. $atext. '+)*\.*)'; |
|
29 | 1 | $invalid_dot_atom = '(?:'. $CFWS. '?'. $invalid_dot_atom_text. '+'. $CFWS. '?)'; |
|
30 | 1 | $quoted_string = $this->getDefinition('quoted-string'); |
|
31 | 1 | $local_part = '(?:'. $invalid_dot_atom. '|'. $quoted_string. ')'; |
|
32 | 1 | $domain_part = '(?:'. implode('|', $fuzzy_domains). ')'; |
|
33 | 1 | $spec = '(?:'. $spec. '|'. $local_part. '@'. $domain_part. ')'; |
|
34 | |||
35 | 1 | return $spec; |
|
36 | default: |
||
37 | /** @noinspection PhpUnhandledExceptionInspection */ |
||
38 | 1 | return parent::getDefinition($name); |
|
39 | } |
||
40 | } |
||
41 | } |