Failed Conditions
Pull Request — 4.0 (#3667)
by k-yamamura
32:38 queued 24:22
created

NoRFCEmailValidator   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 22
rs 10
c 0
b 0
f 0
wmc 3
lcom 0
cbo 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A isValid() 0 13 3
1
<?php
2
3
/*
4
 * This file is part of EC-CUBE
5
 *
6
 * Copyright(c) LOCKON CO.,LTD. All Rights Reserved.
7
 *
8
 * http://www.lockon.co.jp/
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace Eccube\Validator\EmailValidator;
15
16
use Egulias\EmailValidator\EmailValidator;
17
use Egulias\EmailValidator\Validation\EmailValidation;
18
19
class NoRFCEmailValidator extends EmailValidator
20
{
21
    /**
22
     * @param $email
23
     * @param EmailValidation $emailValidation
24
     *
25
     * @return bool
26
     */
27
    public function isValid($email, EmailValidation $emailValidation)
28
    {
29
30
        if (substr_count($email, '@') < 1) {
31
            return false;
32
        }
33
34
        if (!preg_match('/^.+\@\S+\.\S+$/', $email)) {
35
            return false;
36
        }
37
38
        return true;
39
    }
40
}
41