Swift_Validate   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 24
rs 10
c 0
b 0
f 0
wmc 2
lcom 1
cbo 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A email() 0 8 2
1
<?php
2
3
/*
4
 * This file is part of SwiftMailer.
5
 *
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 */
9
10
/**
11
 * Utility Class allowing users to simply check expressions again Swift EmailValidatorBridge.
12
 *
13
 * @author  Xavier De Cock <[email protected]>
14
 */
15
class Swift_Validate
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
16
{
17
    /**
18
     * @var Swift_EmailValidatorBridge
19
     */
20
    private static $_emailValidator = null;
21
22
23
    /**
24
     * Checks if an e-mail address is valid.
25
     *
26
     * @param string $email
27
     *
28
     * @return bool
29
     */
30
    public static function email($email)
31
    {
32
        if (self::$_emailValidator === null) {
33
            self::$_emailValidator = new Swift_EmailValidatorBridge();
34
        }
35
36
        return self::$_emailValidator->isValidWrapper($email);
37
    }
38
}
39