Debug mailer finished and debug messages removed:
[shipsimu.git] / application / ship-simu / main / class_WorksContract.php
index 80ae2eacc3a765c9f60431dd5f1f113bdda9ceda..4a6005911552cce971e9537011f4c59afa048d23 100644 (file)
@@ -4,7 +4,7 @@
  *
  * @author             Roland Haeder <webmaster@ship-simu.org>
  * @version            0.0.0
- * @copyright  Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, this is free software
  * @license            GNU GPL 3.0 or any newer version
  * @link               http://www.ship-simu.org
  *
@@ -65,7 +65,7 @@ class WorksContract extends BaseFrameworkSystem implements SignableContract {
                $contractInstance = new WorksContract();
 
                // Debug-Meldung ausgeben
-               if ((defined('DEBUG_CONTRACT')) || (defined('DEBUG_ALL'))) $contractInstance->getDebugInstance()->output(sprintf("[%s:%d] Neuer Bauvertrag wird f&uuml;r das Schiff <strong>%s</strong> mit der <strong>%s</strong> <strong>%s</strong> erstellt.<br />\n",
+               if ((defined('DEBUG_CONTRACT')) || (defined('DEBUG_ALL'))) $contractInstance->debugOutput(sprintf("[%s:%d] Neuer Bauvertrag wird f&uuml;r das Schiff <strong>%s</strong> mit der <strong>%s</strong> <strong>%s</strong> erstellt.",
                        __CLASS__,
                        __LINE__,
                        $shipName,
@@ -98,40 +98,21 @@ class WorksContract extends BaseFrameworkSystem implements SignableContract {
 
        // Setter for ship instance
        private final function setShipInstance (ConstructableShip $shipInstance) {
-               if ((defined('DEBUG_CONTRACT')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Das Schiff <strong>%s</strong> wird in den Bauvertrag aufgenommen.<br />\n",
-                       __CLASS__,
-                       __LINE__,
-                       $shipInstance->getShipName()
-               ));
                $this->shipInstance = $shipInstance;
        }
 
        // Setter for ship name
        private final function setShipName ($shipName) {
-               if ((defined('DEBUG_CONTRACT')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Das neue Schiff wird <strong>%s</strong> heissen.<br />\n",
-                       __CLASS__,
-                       __LINE__,
-                       $shipName
-               ));
                $this->shipName = (string) $shipName;
        }
 
        // Getter for ship name
        public final function getShipName () {
-               if ((defined('DEBUG_CONTRACT')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Schiffsname <strong>%s</strong> angefordert.<br />\n",
-                       __CLASS__,
-                       __LINE__,
-                       $this->shipName
-               ));
                return $this->shipName;
        }
 
        // Getter for ship instance
        public final function getShipInstance () {
-               if ((defined('DEBUG_CONTRACT')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Schiff-Instanz angefordert.<br />\n",
-                       __CLASS__,
-                       __LINE__
-               ));
                return $this->shipInstance;
        }
 
@@ -142,7 +123,7 @@ class WorksContract extends BaseFrameworkSystem implements SignableContract {
                $parentPart = (string) $parentPart;
 
                // Debug message
-               if ((defined('DEBUG_CONTRACT')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Das Schiffsteil <strong>%s</strong> wird zusammen mit dem Konstruktionsteil <strong>%s</strong> in den Bauvertrag aufgenommen.<br />\n",
+               if ((defined('DEBUG_CONTRACT')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Das Schiffsteil <strong>%s</strong> wird zusammen mit dem Konstruktionsteil <strong>%s</strong> in den Bauvertrag aufgenommen.",
                        __CLASS__,
                        __LINE__,
                        $shipPart,
@@ -156,13 +137,13 @@ class WorksContract extends BaseFrameworkSystem implements SignableContract {
                try {
                        $partInstance = ObjectFactory::createObjectByName($shipPart, $dataArray);
                } catch (DimNotFoundInArrayException $e) {
-                       $this->getDebugInstance()->output(sprintf("[main:] Die <strong>%s</strong> konnte nicht vervollst&auml;ndigt werden. Grund: <strong>%s</strong><br />",
+                       $this->debugOutput(sprintf("[main:] Die <strong>%s</strong> konnte nicht vervollst&auml;ndigt werden. Grund: <strong>%s</strong><br />",
                                $this->getShipInstance()->getShipName(),
                                $e->getMessage()
                        ));
 
                        // Debug message
-                       if ((defined('DEBUG_CONTRACT')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Versuche ein Schiffsteil in den Bauvertrag aufzunehmen.<br />\n",
+                       if ((defined('DEBUG_CONTRACT')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Versuche ein Schiffsteil in den Bauvertrag aufzunehmen.",
                                __CLASS__,
                                __LINE__
                        ));
@@ -186,7 +167,7 @@ class WorksContract extends BaseFrameworkSystem implements SignableContract {
                $price = $this->getMerchantInstance()->getPriceFromList($partInstance);
 
                // Final debug message
-               if ((defined('DEBUG_CONTRACT')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] <strong>%s</strong> kostet <strong>%s</strong>.<br />\n",
+               if ((defined('DEBUG_CONTRACT')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] <strong>%s</strong> kostet <strong>%s</strong>.",
                        __CLASS__,
                        __LINE__,
                        $partInstance->getObjectDescription(),
@@ -197,7 +178,7 @@ class WorksContract extends BaseFrameworkSystem implements SignableContract {
                $partInstance->setPrice($price);
 
                // Final debug message
-               if ((defined('DEBUG_CONTRACT')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] <strong>%s</strong> wurde in den Bauvertrag aufgenommen.<br />\n",
+               if ((defined('DEBUG_CONTRACT')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] <strong>%s</strong> wurde in den Bauvertrag aufgenommen.",
                        __CLASS__,
                        __LINE__,
                        $partInstance->getObjectDescription()
@@ -258,7 +239,7 @@ class WorksContract extends BaseFrameworkSystem implements SignableContract {
                if ((defined('DEBUG_CONTRACT')) || (defined('DEBUG_ALL'))) {
                        if ($partnerInstance->equals($partyInstance)) {
                                // With itself
-                               $this->getDebugInstance()->output(sprintf("[%s:%d] Die <strong>%s</strong> <em><strong>%s</strong></em> stimmt einem Bauvertrag &uuml;ber das <strong>%s</strong> <em><strong>%s</strong></em> zu.<br />\n",
+                               $this->debugOutput(sprintf("[%s:%d] Die <strong>%s</strong> <em><strong>%s</strong></em> stimmt einem Bauvertrag &uuml;ber das <strong>%s</strong> <em><strong>%s</strong></em> zu.",
                                        __CLASS__,
                                        __LINE__,
                                        $partnerInstance->getObjectDescription(),
@@ -268,7 +249,7 @@ class WorksContract extends BaseFrameworkSystem implements SignableContract {
                                ));
                        } else {
                                // Other contract party
-                               $this->getDebugInstance()->output(sprintf("[%s:%d] Die <strong>%s</strong> <em><strong>%s</strong></em> geht mit der <strong>%s</strong> <em><strong>%s</strong></em> einen Bauvertrag &uuml;ber das <strong>%s</strong> <em><strong>%s</strong></em> ein.<br />\n",
+                               $this->debugOutput(sprintf("[%s:%d] Die <strong>%s</strong> <em><strong>%s</strong></em> geht mit der <strong>%s</strong> <em><strong>%s</strong></em> einen Bauvertrag &uuml;ber das <strong>%s</strong> <em><strong>%s</strong></em> ein.",
                                        __CLASS__,
                                        __LINE__,
                                        $partnerInstance->getObjectDescription(),
@@ -333,7 +314,7 @@ class WorksContract extends BaseFrameworkSystem implements SignableContract {
                        } elseif (!is_object($item)) {
                                // Not an object! ;-(
                                throw new NoObjectException($item, self::EXCEPTION_IS_NO_OBJECT);
-                       } elseif (!method_exists($item, 'getPartInstance')) {
+                       } elseif (!$item instanceof BaseSimulator) {
                                // Does not have the required feature (method)
                                throw new MissingMethodException(array($item, 'getPartInstance'), self::EXCEPTION_MISSING_METHOD);
                        }