namespace Org\Mxchange\CoreFramework\Mailer;
// Import framework stuff
+use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
use Org\Mxchange\CoreFramework\Generic\FrameworkInterface;
use Org\Mxchange\CoreFramework\Manager\Login\ManageableMember;
use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem;
+use Org\Mxchange\CoreFramework\Traits\Template\CompileableTemplateTrait;
/**
* A general mailer class for all other mailers
*
* @author Roland Haeder <webmaster@shipsimu.org>
* @version 0.0.0
- * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2017 Core Developer Team
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2023 Core Developer Team
* @license GNU GPL 3.0 or any newer version
* @link http://www.shipsimu.org
*
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
abstract class BaseMailer extends BaseFrameworkSystem {
+ // Load traits
+ use CompileableTemplateTrait;
+
/**
* Template name
*/
* @param $className Name of the class
* @return void
*/
- protected function __construct ($className) {
+ protected function __construct (string $className) {
// Call parent constructor
parent::__construct($className);
}
* @param $templateName Name of the template we shall load
* @return void
*/
- protected final function loadTemplate ($templateName) {
+ protected final function loadTemplate (string $templateName) {
// Set template name
$this->setTemplateName($templateName);
// Get configuration entry
- $templatePrefix = $this->getConfigInstance()->getConfigEntry('email_tpl_' . $templateName);
+ $templatePrefix = FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('email_tpl_' . $templateName);
// Load this email template
$this->getTemplateInstance()->loadEmailTemplate($templatePrefix . '_' . $templateName);
* @param $valueInstance An object instance which can provide "field values"
* @return void
*/
- public final function addValueInstance ($variableName, FrameworkInterface $valueInstance) {
+ public final function addValueInstance (string $variableName, FrameworkInterface $valueInstance) {
$this->setGenericArrayElement('recipients', $this->getTemplateName(), 'values', $variableName, $valueInstance);
}
* @param $templateName Name of email template
* @return void
*/
- public final function setTemplateName ($templateName) {
- $this->templateName = (string) $templateName;
+ public final function setTemplateName (string $templateName) {
+ $this->templateName = $templateName;
}
/**
* @param $subjectLine Subject line to set
* @return void
*/
- public final function setSubjectLine ($subjectLine) {
+ public final function setSubjectLine (string $subjectLine) {
$this->setGenericArrayElement('recipients', $this->getTemplateName(), 'generic', 'subject', $subjectLine);
}
if ((!empty($templateName)) && ($this->isGenericArrayElementSet('recipients', $templateName, 'generic', 'subject'))) {
// Then use it
$subjectLine = $this->getGenericArrayElement('recipients', $templateName, 'generic', 'subject');
- } // END - if
+ }
// Return it
return $subjectLine;