GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 45b6a3...f2282c )
by Samuel
02:39
created

MailerFactory::send()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 4
nc 2
nop 0
1
<?php declare(strict_types=1);
2
/**
3
 * @license MIT
4
 * @author Samuel Adeshina <[email protected]>
5
 *
6
 * This file is part of the EmmetBlue project, please read the license document
7
 * available in the root level of the project
8
 */
9
namespace EmmetBlue\Core\Factory;
10
11
/**
12
 * Class MailerFactory.
13
 *
14
 * @author Samuel Adeshina <[email protected]>
15
 *
16
 * @since v0.0.1 13/02/2017 13:06
17
 */
18
class MailerFactory
19
{
20
	private $mail;
21
	public function __construct(array $sender, array $recipients, array $message){
22
		$smtpConfigJson = file_get_contents("bin/configs/smtp-config.json");
23
24
        $smtpConfig = json_decode($smtpConfigJson);
25
26
		$mail = new \PHPMailer;
27
		$mail->SMTPDebug = $smtpConfig->debug;
28
		$mail->isSMTP();
29
		$mail->Host = $smtpConfig->host;
30
		$mail->SMTPAuth = $smtpConfig->auth;
31
		$mail->Username = $smtpConfig->user;
32
		$mail->Password = $smtpConfig->password;
33
		$mail->SMTPSecure = $smtpConfig->secure;
34
		$mail->Port = $smtpConfig->port;
35
36
		$mail->From = $sender["address"];
37
		$mail->FromName = $sender["name"];
38
		$mail->addReplyTo = $sender["replyTo"];
0 ignored issues
show
Bug introduced by
The property addReplyTo does not seem to exist. Did you mean ReplyTo?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
39
40
		foreach ($recipients as $key => $value) {
41
			$mail->addAddress($value["address"]);
42
		}
43
44
		$mail->Subject = $message["subject"];
45
		$mail->Body = $message["body"];
46
		$mail->AltBody = $message["alt"];
47
		$mail->isHTML($message["isHtml"]);
48
49
		$this->mail = $mail;
50
	}
51
52
	public function send(){
53
		if (!$this->mail->send()){
54
			return $this->mail->ErrorInfo;
55
		}
56
57
		return ["result"=>true];	
58
	}
59
}