IsDomainEqual::execute()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 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