Skip to content
Snippets Groups Projects
Unverified Commit 9afcd53b authored by Tim van Dijen's avatar Tim van Dijen Committed by GitHub
Browse files

Coding style

parent 3dd26604
No related branches found
No related tags found
No related merge requests found
......@@ -19,34 +19,16 @@ use SimpleSAML\XHTML\Template;
class EMail
{
/**
* Get the default e-mail address from the configuration
* This is used both as source and destination address
* unless something else is provided at the constructor.
*
* It will refuse to return the SimpleSAMLphp default address,
* which is na@example.org.
*
* @return string Default mail address
*/
public static function getDefaultMailAddress()
{
$config = Configuration::getInstance();
$address = $config->getString('technicalcontact_email', 'na@example.org');
if ('na@example.org' === $address) {
throw new \Exception('technicalcontact_email must be changed from the default value');
}
return $address;
}
/** @var array Dictionary with multivalues */
private $data;
/** @var string Introduction text */
private $text;
/** @var PHPMailer The mailer instance */
private $mail;
/**
* Constructor
*
......@@ -67,6 +49,28 @@ class EMail
$this->mail->addAddress($to ?: static::getDefaultMailAddress());
}
/**
* Get the default e-mail address from the configuration
* This is used both as source and destination address
* unless something else is provided at the constructor.
*
* It will refuse to return the SimpleSAMLphp default address,
* which is na@example.org.
*
* @return string Default mail address
*/
public static function getDefaultMailAddress()
{
$config = Configuration::getInstance();
$address = $config->getString('technicalcontact_email', 'na@example.org');
if ('na@example.org' === $address) {
throw new \Exception('technicalcontact_email must be changed from the default value');
}
return $address;
}
/**
* Set the data that should be embedded in the e-mail body
*
......@@ -82,6 +86,7 @@ class EMail
$this->data = array_map(function($v){return is_array($v) ? $v : [$v];}, $data);
}
/**
* Set an introduction text for the e-mail
*
......@@ -92,6 +97,7 @@ class EMail
$this->text = $text;
}
/**
* Add a Reply-To address to the mail
*
......@@ -102,6 +108,7 @@ class EMail
$this->mail->addReplyTo($address);
}
/**
* Send the mail
*
......@@ -123,6 +130,7 @@ class EMail
$this->mail->send();
}
/**
* Generate the body of the e-mail
*
......@@ -147,5 +155,4 @@ class EMail
]);
return $result;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment