Mail   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 95
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 1
cbo 1
dl 0
loc 95
ccs 14
cts 14
cp 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A compose() 0 11 1
A send() 0 4 1
1
<?php
2
3
namespace CodeZero\Mailer;
4
5
class Mail
6
{
7
    /**
8
     * To E-mail Address
9
     *
10
     * @var string
11
     */
12
    private $toEmail;
13
14
    /**
15
     * To Name
16
     *
17
     * @var string
18
     */
19
    private $toName;
20
21
    /**
22
     * Subject
23
     *
24
     * @var string
25
     */
26
    private $subject;
27
28
    /**
29
     * View
30
     *
31
     * @var string
32
     */
33
    private $view;
34
35
    /**
36
     * View Data
37
     *
38
     * @var array
39
     */
40
    private $data = array();
41
42
    /**
43
     * Mailer Options
44
     *
45
     * @var callable
46
     */
47
    private $options = null;
48
49
    /**
50
     * Mailer
51
     *
52
     * @var Mailer
53
     */
54
    private $mailer;
55
56
    /**
57
     * Create a new mailer instance.
58
     *
59
     * @param Mailer $mailer
60
     */
61 2
    public function __construct(Mailer $mailer)
62
    {
63 2
        $this->mailer = $mailer;
64 2
    }
65
66
    /**
67
     * Compose an activation mail.
68
     *
69
     * @param string $toEmail
70
     * @param string $toName
71
     * @param string $subject
72
     * @param string $view
73
     * @param array $data
74
     * @param callable $options
75
     *
76
     * @return Mail
77
     */
78 1
    public function compose($toEmail, $toName, $subject, $view, array $data = array(), $options = null)
79
    {
80 1
        $this->toEmail = $toEmail;
81 1
        $this->toName = $toName;
82 1
        $this->subject = $subject;
83 1
        $this->view = $view;
84 1
        $this->data = $data;
85 1
        $this->options = $options;
86
87 1
        return $this;
88
    }
89
90
    /**
91
     * Send an e-mail.
92
     *
93
     * @return void
94
     */
95 1
    public function send()
96
    {
97 1
        $this->mailer->send($this->toEmail, $this->toName, $this->subject, $this->view, $this->data, $this->options);
98 1
    }
99
}
100