Remove unnecessary test_email extra parameter for mailer->send

It was used only to prevent appending unprocessed subscribers into error message.
Since the message is now composed by on demand by MailerError the parameter is not needed any more.

[MAILPOET-1154]
This commit is contained in:
Rostislav Wolny
2018-09-11 19:52:50 +02:00
parent 665fce9dbb
commit f5c9d0f7db
13 changed files with 28 additions and 53 deletions

View File

@ -12,7 +12,7 @@ class SMTPMapper {
* @see https://swiftmailer.symfony.com/docs/sending.html
* @return MailerError
*/
function getErrorFromException(\Exception $e, $subscriber, $extra_params = []) {
function getErrorFromException(\Exception $e, $subscriber) {
// remove redundant information appended by Swift logger to exception messages
$message = explode(PHP_EOL, $e->getMessage());
@ -20,16 +20,11 @@ class SMTPMapper {
if($e instanceof \Swift_RfcComplianceException) {
$level = MailerError::LEVEL_SOFT;
}
$subscriber_errors = [];
if(empty($extra_params['test_email'])) {
$subscriber_errors[] = new SubscriberError($subscriber, null);
}
$subscriber_errors = [new SubscriberError($subscriber, null)];
return new MailerError(MailerError::OPERATION_SEND, $level, $message[0], null, $subscriber_errors);
}
function getErrorFromLog($log, $subscriber, $extra_params = []) {
function getErrorFromLog($log, $subscriber) {
// extract error message from log
preg_match('/!! (.*?)>>/ism', $log, $message);
if(!empty($message[1])) {
@ -39,11 +34,7 @@ class SMTPMapper {
} else {
$message = sprintf(__('%s has returned an unknown error.', 'mailpoet'), Mailer::METHOD_SMTP);
}
$subscriber_errors = [];
if(empty($extra_params['test_email'])) {
$subscriber_errors[] = new SubscriberError($subscriber, null);
}
$subscriber_errors = [new SubscriberError($subscriber, null)];
return new MailerError(MailerError::OPERATION_SEND, MailerError::LEVEL_HARD, $message, null, $subscriber_errors);
}
}