]> git.mxchange.org Git - core.git/blobdiff - framework/main/classes/mailer/debug/class_DebugMailer.php
Continued:
[core.git] / framework / main / classes / mailer / debug / class_DebugMailer.php
index 4f1c8ec670c14ce9b261dbf0e20bde8a0a6674a7..7a606f9eeefb06f105bd533894032e5bd7600894 100644 (file)
@@ -12,13 +12,16 @@ use Org\Mxchange\CoreFramework\Manager\Login\ManageableMember;
 use Org\Mxchange\CoreFramework\Registry\GenericRegistry;
 use Org\Mxchange\CoreFramework\Template\CompileableTemplate;
 
+// Import SPL stuff
+use \UnexpectedValueException;
+
 /**
  * A mailer class for debugging purposes only. This class will print the
  * prepared mail out and will not send it to the recipient.
  *
  * @author             Roland Haeder <webmaster@shipsimu.org>
  * @version            0.0.0
- * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2020 Core Developer Team
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2021 Core Developer Team
  * @license            GNU GPL 3.0 or any newer version
  * @link               http://www.shipsimu.org
  *
@@ -41,7 +44,7 @@ class DebugMailer extends BaseMailer implements DeliverableMail {
         *
         * @return      void
         */
-       protected function __construct () {
+       private function __construct () {
                // Call parent constructor
                parent::__construct(__CLASS__);
        }
@@ -72,7 +75,7 @@ class DebugMailer extends BaseMailer implements DeliverableMail {
         * Deliver email to the recipient(s)
         *
         * @return      void
-        * @throws      InvalidInterfaceException       If the recipient instance does not implement ManageableMember
+        * @throws      UnexpectedValueException        If the recipient instance does not implement ManageableMember
         */
        public function deliverEmail () {
                // Get template instance
@@ -85,7 +88,7 @@ class DebugMailer extends BaseMailer implements DeliverableMail {
                                // The recipient should be a user instance, right?
                                if (!$recipientInstance instanceof ManageableMember) {
                                        // Invalid entry found!
-                                       throw new InvalidInterfaceException(array($this, 'ManageableMember'), self::EXCEPTION_REQUIRED_INTERFACE_MISSING);
+                                       throw new UnexpectedValueException(sprintf('recipientInstance[]=%s does not implement ManageableMember', gettype($recipientInstance)));
                                }
 
                                // User class found, so entry is valid, first load the template
@@ -98,7 +101,7 @@ class DebugMailer extends BaseMailer implements DeliverableMail {
                                foreach ($recipientList['config_vars'] as $variable => $dummy) {
                                        // Load the config value and set it
                                        $templateInstance->assignConfigVariable($variable);
-                               } // END - if
+                               }
 
                                // Now do the same with the values but ask the "value instance" instead!
                                foreach ($recipientList['value_vars'] as $variable => $dummy) {
@@ -106,7 +109,7 @@ class DebugMailer extends BaseMailer implements DeliverableMail {
                                        if (!isset($recipientList['values'][$variable])) {
                                                // Throw exception
                                                throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER);
-                                       } // END - if
+                                       }
 
                                        // Get the field from the value instance
                                        $fieldValue = $recipientList['values'][$variable]->getField($variable);
@@ -123,8 +126,8 @@ class DebugMailer extends BaseMailer implements DeliverableMail {
 
                                // Transfer the data to the response
                                $templateInstance->transferToResponse($responseInstance);
-                       } // END - foreach
-               } // END - foreach
+                       }
+               }
        }
 
        /**