Completed
Push — master ( 33e787...10dfaa )
by Mahmoud
03:41
created

SendContactUsEmailTask   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A run() 0 10 1
1
<?php
2
3
namespace App\Containers\Contact\Tasks;
4
5
use App\Containers\Contact\Mails\ContactUsEmail;
6
use App\Port\Task\Abstracts\Task;
7
8
/**
9
 * Class SendContactUsEmailTask.
10
 *
11
 * @author Mahmoud Zalt <[email protected]>
12
 */
13
class SendContactUsEmailTask extends Task
14
{
15
16
    /**
17
     * @var  \App\Containers\Contact\Mails\ContactUsEmail
18
     */
19
    private $email;
20
21
    /**
22
     * SampleAction constructor.
23
     *
24
     * @param \App\Containers\Contact\Mails\ContactUsEmail $contactUsEmail
25
     */
26
    public function __construct(ContactUsEmail $contactUsEmail)
27
    {
28
        $this->email = $contactUsEmail;
29
    }
30
31
    /**
32
     * @param        $fromEmail
33
     * @param        $message
34
     * @param string $subject
35
     * @param string $fromName
36
     *
37
     * @return  bool
38
     */
39
    public function run($fromEmail, $message, $subject = 'No Subject', $fromName = 'No Name')
40
    {
41
        $this->email->setSubject($subject);
42
        $result = $this->email->from($fromEmail, $fromName)->send([
43
            'name'    => $fromName,
44
            'content' => $message,
45
        ]);
46
47
        return $result;
48
    }
49
}
50