Fixes for image generation
[shipsimu.git] / inc / classes / main / mailer / debug / class_DebugMailer.php
index 9e2aea10a43d54312d1a83b1373064dcda1c2f13..042ee69194122982abbf123343e0e495f9a0bfd4 100644 (file)
@@ -31,12 +31,6 @@ class DebugMailer extends BaseMailer implements DeliverableMail {
        protected function __construct () {
                // Call parent constructor
                parent::__construct(__CLASS__);
-
-               // Set part description
-               $this->setObjectDescription("A mailer for debugging purposes");
-
-               // Create unique ID number
-               $this->generateUniqueId();
        }
 
        /**
@@ -68,6 +62,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
         */
        public function deliverEmail () {
                // Get template instance
@@ -78,46 +73,46 @@ class DebugMailer extends BaseMailer implements DeliverableMail {
                        // Walk through all recipients and "sent", or better print, it out
                        foreach ($recipientList['recipients'] as $recipientInstance) {
                                // The recipient should be a user instance, right?
-                               if ($recipientInstance instanceof ManageableMember) {
-                                       // User class found, so entry is valid, first load the template
-                                       $this->loadTemplate($templateName);
+                               if (!$recipientInstance instanceof ManageableMember) {
+                                       // Invalid entry found!
+                                       throw new InvalidInterfaceException(array($this, 'ManageableMember'), self::EXCEPTION_REQUIRED_INTERFACE_MISSING);
+                               }
 
-                                       // Set subject line
-                                       $templateInstance->assignVariable('subject', $this->getSubjectLine());
+                               // User class found, so entry is valid, first load the template
+                               $this->loadTemplate($templateName);
 
-                                       // Walk through all variables, first config to assign them
-                                       foreach ($recipientList['config_vars'] as $variable=>$dummy) {
-                                               // Load the config value and set it
-                                               $templateInstance->assignConfigVariable($variable);
-                                       } // END - if
+                               // Set subject line
+                               $templateInstance->assignVariable('subject', $this->getSubjectLine());
 
-                                       // Now do the same with the values but ask the "value instance" instead!
-                                       foreach ($recipientList['value_vars'] as $variable=>$dummy) {
-                                               // Is the value instance there?
-                                               if (!isset($recipientList['values'][$variable])) {
-                                                       // Throw exception
-                                                       throw new NullPointerException ($this, self::EXCEPTION_IS_NULL_POINTER);
-                                               } // END - if
+                               // Walk through all variables, first config to assign them
+                               foreach ($recipientList['config_vars'] as $variable => $dummy) {
+                                       // Load the config value and set it
+                                       $templateInstance->assignConfigVariable($variable);
+                               } // END - if
 
-                                               // Get the field from the value instance
-                                               $fieldValue = $recipientList['values'][$variable]->getField($variable);
+                               // Now do the same with the values but ask the "value instance" instead!
+                               foreach ($recipientList['value_vars'] as $variable => $dummy) {
+                                       // Is the value instance there?
+                                       if (!isset($recipientList['values'][$variable])) {
+                                               // Throw exception
+                                               throw new NullPointerException ($this, self::EXCEPTION_IS_NULL_POINTER);
+                                       } // END - if
 
-                                               // Set it in the template engine
-                                               $templateInstance->assignVariable($variable, $fieldValue);
-                                       }
+                                       // Get the field from the value instance
+                                       $fieldValue = $recipientList['values'][$variable]->getField($variable);
 
-                                       // Render the content
-                                       $templateInstance->renderXmlContent();
+                                       // Set it in the template engine
+                                       $templateInstance->assignVariable($variable, $fieldValue);
+                               }
 
-                                       // Get responce instance
-                                       $responseInstance = $this->getApplicationInstance()->getResponseInstance();
+                               // Render the content
+                               $templateInstance->renderXmlContent();
 
-                                       // Transfer the data to the response
-                                       $this->getTemplateInstance()->transferToResponse($responseInstance);
-                               } else {
-                                       // Invalid entry found!
-                                       $this->partialStub("Handling of invalid recipient entries not yet finished.");
-                               }
+                               // Get responce instance
+                               $responseInstance = $this->getApplicationInstance()->getResponseInstance();
+
+                               // Transfer the data to the response
+                               $this->getTemplateInstance()->transferToResponse($responseInstance);
                        } // END - foreach
                } // END - foreach
        }