mageekguy\atoum\mailer: lines coverage

100% of 174

OPs

100% of 39

Lines

97% of 30

Branches

95% of 20

Paths
Method OPs OPs % Lines Line % Branches Branches % Paths Path %
mageekguy\atoum\mailer::__construct() 17 100% 2 100% 1 0% 1 100%
mageekguy\atoum\mailer::setAdapter() 9 100% 2 100% 1 100% 1 100%
mageekguy\atoum\mailer::getAdapter() 6 100% 1 100% 1 100% 1 100%
mageekguy\atoum\mailer::addTo() 30 100% 10 100% 8 100% 4 75%
mageekguy\atoum\mailer::getTo() 6 100% 1 100% 1 100% 1 100%
mageekguy\atoum\mailer::setSubject() 10 100% 2 100% 1 100% 1 100%
mageekguy\atoum\mailer::getSubject() 6 100% 1 100% 1 100% 1 100%
mageekguy\atoum\mailer::setFrom() 22 100% 6 100% 5 100% 2 100%
mageekguy\atoum\mailer::getFrom() 6 100% 1 100% 1 100% 1 100%
mageekguy\atoum\mailer::setReplyTo() 22 100% 6 100% 5 100% 2 100%
mageekguy\atoum\mailer::getReplyTo() 6 100% 1 100% 1 100% 1 100%
mageekguy\atoum\mailer::setXMailer() 10 100% 2 100% 1 100% 1 100%
mageekguy\atoum\mailer::getXMailer() 6 100% 1 100% 1 100% 1 100%
mageekguy\atoum\mailer::setContentType() 12 100% 2 100% 1 100% 1 100%
mageekguy\atoum\mailer::getContentType() 6 100% 1 100% 1 100% 1 100%
#
1
<?php
2

                    
3
namespace mageekguy\atoum;
4

                    
5
use
6
	mageekguy\atoum,
7
	mageekguy\atoum\exceptions
8
;
9

                    
10
abstract class mailer
11
{
12
	protected $to = null;
13
	protected $from = null;
14
	protected $xMailer = null;
15
	protected $replyTo = null;
16
	protected $subject = null;
17
	protected $contentType = null;
18
	protected $adapter = null;
19

                    
20
	public function __construct(atoum\adapter $adapter = null)100%
21
	{
22
		$this->setAdapter($adapter ?: new atoum\adapter());
23
	}
24

                    
25
	public function setAdapter(atoum\adapter $adapter)100%
26
	{
27
		$this->adapter = $adapter;
28

                    
29
		return $this;
30
	}
31

                    
32
	public function getAdapter()100%
33
	{
34
		return $this->adapter;
35
	}
36

                    
37
	public function addTo($to, $realName = null)100%
38
	{
39
		if ($this->to !== null)
40
		{
41
			$this->to .= ',';
42
		}
43

                    
44
		if ($realName === null)
45
		{
46
			$this->to .= $to;
47
		}
48
		else
49
		{
50
			$this->to .= $realName . ' <' . $to . '>';
51
		}
52

                    
53
		return $this;
54
	}
55

                    
56
	public function getTo()100%
57
	{
58
		return $this->to;
59
	}
60

                    
61
	public function setSubject($subject)100%
62
	{
63
		$this->subject = (string) $subject;
64

                    
65
		return $this;
66
	}
67

                    
68
	public function getSubject()100%
69
	{
70
		return $this->subject;
71
	}
72

                    
73
	public function setFrom($from, $realName = null)100%
74
	{
75
		if ($realName === null)
76
		{
77
			$this->from = (string) $from;
78
		}
79
		else
80
		{
81
			$this->from = $realName . ' <' . $from . '>';
82
		}
83

                    
84
		return $this;
85
	}
86

                    
87
	public function getFrom()100%
88
	{
89
		return $this->from;
90
	}
91

                    
92
	public function setReplyTo($replyTo, $realName = null)100%
93
	{
94
		if ($realName === null)
95
		{
96
			$this->replyTo = (string) $replyTo;
97
		}
98
		else
99
		{
100
			$this->replyTo = $realName . ' <' . $replyTo . '>';
101
		}
102

                    
103
		return $this;
104
	}
105

                    
106
	public function getReplyTo()100%
107
	{
108
		return $this->replyTo;
109
	}
110

                    
111
	public function setXMailer($mailer)100%
112
	{
113
		$this->xMailer = (string) $mailer;
114

                    
115
		return $this;
116
	}
117

                    
118
	public function getXMailer()100%
119
	{
120
		return $this->xMailer;
121
	}
122

                    
123
	public function setContentType($type = 'text/plain', $charset = 'utf-8')100%
124
	{
125
		$this->contentType = array($type, $charset);
126

                    
127
		return $this;
128
	}
129

                    
130
	public function getContentType()100%
131
	{
132
		return $this->contentType;
133
	}
134

                    
135
	public abstract function send($something);
136
}