IsDomainEqual   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 0
dl 0
loc 34
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getDomain() 0 4 1
A execute() 0 6 1
1
<?php
2
3
namespace Openbuildings\Swiftmailer;
4
5
/**
6
 * @author     Ivan Kerin <[email protected]>
7
 * @copyright  (c) 2015 Clippings Ltd.
8
 * @license    http://spdx.org/licenses/BSD-3-Clause
9
 */
10
class IsDomainEqual implements MatchInterface
11
{
12
	/**
13
	 * @var string
14
	 */
15
	private $domain;
16
17
	/**
18
	 * @param string $domain
19
	 */
20 1
	public function __construct($domain)
21
	{
22 1
		$this->domain = $domain;
23 1
	}
24
25
	/**
26
	 * @return string
27
	 */
28 1
	public function getDomain()
29
	{
30 1
		return $this->domain;
31
	}
32
33
	/**
34
	 * @param  string $email
35
	 * @return boolean
36
	 */
37 1
	public function execute($email)
38
	{
39 1
		list( , $domain) = explode('@', $email);
40
41 1
		return $this->domain === $domain;
42
	}
43
}
44