Refactoring for better reading

This commit is contained in:
Antonin 2015-10-26 16:28:59 +01:00
parent 0e0becb5c4
commit 974148550b

View File

@ -36,31 +36,33 @@ class NotificationService {
if ($poll->receiveNewVotes) { if ($poll->receiveNewVotes) {
if (self::isParticipation($type)) if (self::isParticipation($type)) {
$translationString = 'Poll\'s participation: %s'; $translationString = 'Poll\'s participation: %s';
else } else {
$translationString = 'Notification of poll: %s'; $translationString = 'Notification of poll: %s';
}
$subject = '[' . NOMAPPLICATION . '] ' . __f('Mail', $translationString, $poll->title); $subject = '[' . NOMAPPLICATION . '] ' . __f('Mail', $translationString, $poll->title);
$message = ''; $message = '';
if (self::isParticipation($type))
$message .= $name . ' ';
$urlSondage = Utils::getUrlSondage($poll->admin_id, true); $urlSondage = Utils::getUrlSondage($poll->admin_id, true);
$link = '<a href="' . $urlSondage . '">' . $urlSondage . '</a>' . "\n\n"; $link = '<a href="' . $urlSondage . '">' . $urlSondage . '</a>' . "\n\n";
switch ($type) { switch ($type) {
case self::UPDATE_VOTE: case self::UPDATE_VOTE:
$message .= $name . ' ';
$message .= __('Mail', "updated a vote.\nYou can find your poll at the link") . " :\n\n"; $message .= __('Mail', "updated a vote.\nYou can find your poll at the link") . " :\n\n";
$message .= $link; $message .= $link;
break; break;
case self::ADD_VOTE: case self::ADD_VOTE:
$message .= $name . ' ';
$message .= __('Mail', "filled a vote.\nYou can find your poll at the link") . " :\n\n"; $message .= __('Mail', "filled a vote.\nYou can find your poll at the link") . " :\n\n";
$message .= $link; $message .= $link;
break; break;
case self::ADD_COMMENT: case self::ADD_COMMENT:
$message .= $name . ' ';
$message .= __('Mail', "wrote a comment.\nYou can find your poll at the link") . " :\n\n"; $message .= __('Mail', "wrote a comment.\nYou can find your poll at the link") . " :\n\n";
$message .= $link; $message .= $link;
break; break;