]> git.mxchange.org Git - core.git/commitdiff
Evn more quotes rewritten, old try-catch-blocks removed from old tests
authorRoland Häder <roland@mxchange.org>
Fri, 13 Mar 2009 20:59:39 +0000 (20:59 +0000)
committerRoland Häder <roland@mxchange.org>
Fri, 13 Mar 2009 20:59:39 +0000 (20:59 +0000)
inc/classes.php
inc/config.php
inc/database.php
inc/language.php
tests/old/contract-test.php
tests/old/loader-test.php
tests/old/personell-test.php

index dbeb75a49db1ce25824d4e3c1e27bcc907856e39..9d1af75d4a9dd09d19e76f921dd86c46e0220754 100644 (file)
@@ -32,30 +32,8 @@ $lowerClasses = array(
 // Load all classes
 foreach ($lowerClasses as $className) {
        // Try to load the framework classes
-       try {
-               ClassLoader::getInstance()->scanClassPath(sprintf("inc/classes/%s/", $className));
-       } catch (PathIsNoDirectoryException $e) {
-               ApplicationEntryPoint::app_die(sprintf("[Main:] Could not load framework classes from path <span class=\"exception_data\">%s</span> for the follwing reason: <span class=\"exception_reason\">%s</span>",
-                       $className,
-                       $e->getMessage()
-               ));
-       } catch (PathIsEmptyException $e) {
-               ApplicationEntryPoint::app_die(sprintf("[Main:] Could not load framework classes from path <span class=\"exception_data\">%s</span> for the follwing reason: <span class=\"exception_reason\">%s</span>",
-                       $className,
-                       $e->getMessage()
-               ));
-       } catch (PathReadProtectedException $e) {
-               ApplicationEntryPoint::app_die(sprintf("[Main:] Could not load framework classes from path <span class=\"exception_data\">%s</span> for the follwing reason: <span class=\"exception_reason\">%s</span>",
-                       $className,
-                       $e->getMessage()
-               ));
-       } catch (DirPointerNotOpenedException $e) {
-               ApplicationEntryPoint::app_die(sprintf("[Main:] Could not load framework classes from path <span class=\"exception_data\">%s</span> for the follwing reason: <span class=\"exception_reason\">%s</span>",
-                       $className,
-                       $e->getMessage()
-               ));
-       }
-}
+       ClassLoader::getInstance()->scanClassPath(sprintf("inc/classes/%s/", $className));
+} // END - foreach
 
 // Clean up the global namespace
 unset($lowerClasses[3]); // Applications shall not have any middleware
index 63940c8d30d108c268281b7c6d89dcb0ca386bfc..d46207331f9b536d02bdaa54a389cb10994f1438 100644 (file)
@@ -117,16 +117,16 @@ $cfg->setConfigEntry('web_content_type', "text/html");
 $cfg->setConfigEntry('tpl_valid_var', "content");
 
 // CFG: META-AUTHOR
-$cfg->setConfigEntry('meta_author', "Roland H&auml;der");
+$cfg->setConfigEntry('meta_author', "Your-name-here");
 
 // CFG: META-PUBLISHER
-$cfg->setConfigEntry('meta_publisher', "Roland H&auml;der");
+$cfg->setConfigEntry('meta_publisher', "Your-name-here");
 
 // CFG: META-KEYWORDS
 $cfg->setConfigEntry('meta_keywords', "test,test,test");
 
 // CFG: META-DESCRIPTION
-$cfg->setConfigEntry('meta_description', "A lame description for an application framework");
+$cfg->setConfigEntry('meta_description', "A description for your website");
 
 // CFG: SELECTOR-MAIN-TEMPLATE
 $cfg->setConfigEntry('selector_main_tpl', "selector_main");
index 30792197135d5d46a6e70f4d9112128bbc285e8f..544a2a55dc3f51f4b487336b620d4953c8b05b0f 100644 (file)
@@ -49,35 +49,10 @@ if ((file_exists($INC)) && (is_file($INC)) && (is_readable($INC))) {
 unset($INC);
 
 // Prepare database instance
-try {
-       $db = DatabaseConnection::createDatabaseConnection(DebugMiddleware::getInstance(), $layerInstance);
-} catch (NullPointerException $e) {
-       ApplicationEntryPoint::app_die(sprintf("[Main:] Database sub-system not initialized for the follwing reason: <span class=\"exception_reason\">%s</span><br />\n",
-               $e->getMessage()
-       ));
-} catch (InvalidDirectoryResourceException $e) {
-       ApplicationEntryPoint::app_die(sprintf("[Main:] Database sub-system not initialized for the follwing reason: <span class=\"exception_reason\">%s</span><br />\n",
-               $e->getMessage()
-       ));
-} catch (PathIsEmptyException $e) {
-       ApplicationEntryPoint::app_die(sprintf("[Main:] Database sub-system not initialized for the follwing reason: <span class=\"exception_reason\">%s</span><br />\n",
-               $e->getMessage()
-       ));
-} catch (PathIsNoDirectoryException $e) {
-       ApplicationEntryPoint::app_die(sprintf("[Main:] Database sub-system not initialized for the follwing reason: <span class=\"exception_reason\">%s</span><br />\n",
-               $e->getMessage()
-       ));
-} catch (PathReadProtectedException $e) {
-       ApplicationEntryPoint::app_die(sprintf("[Main:] Database sub-system not initialized for the follwing reason: <span class=\"exception_reason\">%s</span><br />\n",
-               $e->getMessage()
-       ));
-} catch (DirPointerNotOpenedException $e) {
-       ApplicationEntryPoint::app_die(sprintf("[Main:] Database sub-system not initialized for the follwing reason: <span class=\"exception_reason\">%s</span><br />\n",
-               $e->getMessage()
-       ));
-}
+$db = DatabaseConnection::createDatabaseConnection(DebugMiddleware::getInstance(), $layerInstance);
 
 // Is the app variable there and valid?
+// @TODO Rewrite this
 if (is_object($app)) $app->setDatabaseInstance($db);
 
 // [EOF]
index 7f63099c00b277fe319d48e24b60515d92479962..30a3575128c1ba0cbc8c33db42cfad6863081df9 100644 (file)
  * You should have received a copy of the GNU General Public License
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
-try {
-       $lang = LanguageSystem::createLanguageSystem(
-               $cfg->readConfig('base_path').
-               FrameworkConfiguration::getInstance()->readConfig('lang_base_path')
-       );
-} catch (LanguagePathIsEmptyException $e) {
-       ApplicationEntryPoint::app_die(sprintf("[Main:] The language sub-system could not be initialized for the following reason: <span class=\"exception_reason\">%s</span>",
-               $e->getMessage()
-       ));
-} catch (InvalidLanguagePathStringException $e) {
-       ApplicationEntryPoint::app_die(sprintf("[Main:] The language sub-system could not be initialized for the following reason: <span class=\"exception_reason\">%s</span>",
-               $e->getMessage()
-       ));
-} catch (LanguagePathIsNoDirectoryException $e) {
-       ApplicationEntryPoint::app_die(sprintf("[Main:] The language sub-system could not be initialized for the following reason: <span class=\"exception_reason\">%s</span>",
-               $e->getMessage()
-       ));
-} catch (LanguagePathReadProtectedException $e) {
-       ApplicationEntryPoint::app_die(sprintf("[Main:] The language sub-system could not be initialized for the following reason: <span class=\"exception_reason\">%s</span>",
-               $e->getMessage()
-       ));
-}
+
+// Try to instance the language system
+$lang = LanguageSystem::createLanguageSystem(
+       $cfg->readConfig('base_path').
+       FrameworkConfiguration::getInstance()->readConfig('lang_base_path')
+);
 
 // Is the app variable there and valid?
+// @TODO Rewrite this
 if (is_object($app)) $app->setLanguageInstance($lang);
 
 // [EOF]
index 5dfeabf4b90c714e5f66d486d84e184498d50e28..ccf6fdb9b75e27b7d9534f72fba968780da8d73c 100644 (file)
@@ -1,12 +1,12 @@
 <?php
 // Change directory
-@chdir("../..");
+@chdir('../..');
 
 // Set testing mode (no starter.php will be loaded!)
 define('TEST_MODE', true);
 
 // Load config file
-require(dirname(dirname(dirname(__FILE__))) . "/inc/config.php");
+require(dirname(dirname(dirname(__FILE__))) . '/inc/config.php');
 
 // Load all include files
 require($cfg->readConfig('base_path') . 'inc/includes.php');
@@ -29,69 +29,7 @@ require($cfg->readConfig('base_path') . 'application/ship-simu/loader.php');
 
 // Wir tun hier so, als waere schon das Reederei-Objekt generiert und wir wollen
 // jetzt die Personalliste wiederherstellen
-try {
-       $personell = SimulatorPersonell::createSimulatorPersonellByID('SimulatorPersonell@829292aeca3f6bf78c16e25fc4f75c98');
-} catch (InvalidIDFormatException $e) {
-       die(sprintf("[Main:] Could  not create personal list for follwing reason: <span class=\"exception_reason\">%s</span><br />\n",
-               $e->getMessage()
-       ));
-} catch (InvalidArrayCountException $e) {
-       die(sprintf("[Main:] Could  not create personal list for follwing reason: <span class=\"exception_reason\">%s</span><br />\n",
-               $e->getMessage()
-       ));
-} catch (NullPointerException $e) {
-       die(sprintf("[Main:] Could  not create personal list for follwing reason: <span class=\"exception_reason\">%s</span><br />\n",
-               $e->getMessage()
-       ));
-} catch (NoObjectException $e) {
-       die(sprintf("[Main:] Could  not create personal list for follwing reason: <span class=\"exception_reason\">%s</span><br />\n",
-               $e->getMessage()
-       ));
-} catch (MissingMethodException $e) {
-       die(sprintf("[Main:] Could  not create personal list for follwing reason: <span class=\"exception_reason\">%s</span><br />\n",
-               $e->getMessage()
-       ));
-} catch (FileIsEmptyException $e) {
-       die(sprintf("[Main:] Could  not create personal list for follwing reason: <span class=\"exception_reason\">%s</span><br />\n",
-               $e->getMessage()
-       ));
-} catch (FilePointerNotOpenedException $e) {
-       die(sprintf("[Main:] Could  not create personal list for follwing reason: <span class=\"exception_reason\">%s</span><br />\n",
-               $e->getMessage()
-       ));
-} catch (InvalidArrayCountException $e) {
-       die(sprintf("[Main:] Could  not create personal list for follwing reason: <span class=\"exception_reason\">%s</span><br />\n",
-               $e->getMessage()
-       ));
-} catch (InvalidMD5ChecksumException $e) {
-       die(sprintf("[Main:] Could  not create personal list for follwing reason: <span class=\"exception_reason\">%s</span><br />\n",
-               $e->getMessage()
-       ));
-} catch (InvalidDataLengthException $e) {
-       die(sprintf("[Main:] Could  not create personal list for follwing reason: <span class=\"exception_reason\">%s</span><br />\n",
-               $e->getMessage()
-       ));
-} catch (InvalidSimulatorIDException $e) {
-       die(sprintf("[Main:] Could  not create personal list for follwing reason: <span class=\"exception_reason\">%s</span><br />\n",
-               $e->getMessage()
-       ));
-} catch (MismatchingCompressorsException $e) {
-       die(sprintf("[Main:] Could  not create personal list for follwing reason: <span class=\"exception_reason\">%s</span><br />\n",
-               $e->getMessage()
-       ));
-} catch (ContainerItemIsNullException $e) {
-       die(sprintf("[Main:] Could  not create personal list for follwing reason: <span class=\"exception_reason\">%s</span><br />\n",
-               $e->getMessage()
-       ));
-} catch (ContainerItemIsNoArrayException $e) {
-       die(sprintf("[Main:] Could  not create personal list for follwing reason: <span class=\"exception_reason\">%s</span><br />\n",
-               $e->getMessage()
-       ));
-} catch (ContainerMaybeDamagedException $e) {
-       die(sprintf("[Main:] Could  not create personal list for follwing reason: <span class=\"exception_reason\">%s</span><br />\n",
-               $e->getMessage()
-       ));
-}
+$personell = SimulatorPersonell::createSimulatorPersonellByID('SimulatorPersonell@829292aeca3f6bf78c16e25fc4f75c98');
 
 // Personal-Objekt debuggen
 if (defined('DEBUG_PERSONELL_OBJ')) {
@@ -246,29 +184,21 @@ foreach ($einbauten['parts'] as $key=>$part) {
        // Random price
        $price = mt_rand(5, 12) * 10000;
 
-       // Give it a try...
-       try {
-               // Generate command for adding objects to a price list
-               $eval = sprintf("\$merchant->addItemToPriceList(%s::create%s(%s), %d);",
-                       $key,
-                       $key,
-                       $item,
-                       $price
-               );
-
-               // Debug message
-               if ((defined('DEBUG_EVAL')) || (defined('DEBUG_ALL'))) DebugMiddleware::getInstance()->output(sprintf("[Main:] Konstruierte PHP-Anweisung: <pre><em>%s</em></pre><br />\n",
-                       htmlentities($eval)
-               ));
-
-               // Run the constructed command
-               eval($eval);
-       } catch (ItemNotTradeableException $e) {
-               die(sprintf("[Main:] Die Preisliste des H&auml;ndlers <span class=\"exception_reason\">%s</span> kann nicht bef&uuml;llt werden. Grund: <span class=\"exception_reason\">%s</span><br />\n",
-                       $merchant->getMerchantName(),
-                       $e->getMessage()
-               ));
-       }
+       // Generate command for adding objects to a price list
+       $eval = sprintf("\$merchant->addItemToPriceList(%s::create%s(%s), %d);",
+               $key,
+               $key,
+               $item,
+               $price
+       );
+
+       // Debug message
+       if ((defined('DEBUG_EVAL')) || (defined('DEBUG_ALL'))) DebugMiddleware::getInstance()->output(sprintf("[Main:] Konstruierte PHP-Anweisung: <pre><em>%s</em></pre><br />\n",
+               htmlentities($eval)
+       ));
+
+       // Run the constructed command
+       eval($eval);
 }
 
 // Haendler-Objekt debuggen
@@ -284,13 +214,7 @@ if (defined('DEBUG_MERCHANT_OBJ')) {
 $shipping = ShippingCompany::createShippingCompany("Hanseatic Travel Company", $harbor);
 
 // Firmenschef setzen
-try {
-       $shipping->setCompanyFounder(CompanyEmployee::createCompanyEmployee("Roland", "H&auml;der", "M", 1977, 9, 26, true, 2000));
-} catch (BirthdayInvalidException $e) {
-       die(sprintf("[Main:] Reederei-Gr&uuml;nder konnte nicht gesetzt werden. Grund: <span class=\"exception_reason\">%s</span><br />\n",
-               $e->getMessage()
-       ));
-}
+$shipping->setCompanyFounder(CompanyEmployee::createCompanyEmployee("Roland", "H&auml;der", "M", 1977, 9, 26, true, 2000));
 
 // Dann mal ausgeben...
 DebugMiddleware::getInstance()->output(sprintf("Die Reederei <span class=\"exception_reason\">%s</span> ist von <strong>%s %s</strong> gegr&uuml;ndet worden.<br />\n",
@@ -300,19 +224,7 @@ DebugMiddleware::getInstance()->output(sprintf("Die Reederei <span class=\"excep
 ));
 
 // Die Reederei stellt Personal ein und bedient sich an der $personell-Instanz
-try {
-       $shipping->recruitRandomEmployees(10, $personell);
-} catch (ToMuchEmployeesException $e) {
-       die(sprintf("[Main:] Die Reederei <span class=\"exception_reason\">%s</span> konnte kein Personal einstellen. Grund: <span class=\"exception_reason\">%s</span><br />\n",
-               $shipping->getCompanyName(),
-               $e->getMessage()
-       ));
-} catch (OutOfBoundsException $e) {
-       die(sprintf("[Main:] Die Reederei <span class=\"exception_reason\">%s</span> konnte kein Personal einstellen. Grund: <span class=\"exception_reason\">%s</span><br />\n",
-               $shipping->getCompanyName(),
-               $e->getMessage()
-       ));
-}
+$shipping->recruitRandomEmployees(10, $personell);
 
 // Anzahl Personal ausgeben
 DebugMiddleware::getInstance()->output(sprintf("Die Reederei <span class=\"exception_reason\">%s</span> hat nun <strong>%d</strong> weitere Mitarbeiter.<br />\n",
@@ -326,49 +238,10 @@ $shipping->createShipyardInHarbor("Werft 2", $harbor);
 $shipping->createShipyardInHarbor("Werft 3", $harbor);
 
 // In alle Werften sollen Passagierschiffe gebaut werden koennen
-try {
-       $shipping->addShipTypeToAllShipyards("PassengerShip");
-} catch (ClassNotFoundException $e) {
-       die(sprintf("[Main:] Die Reederei <span class=\"exception_reason\">%s</span> kann ihre Werften nicht besch&auml;ftigen. Grund: <span class=\"exception_reason\">%s</span><br />\n",
-               $shipping->getCompanyName(),
-               $e->getMessage()
-       ));
-} catch (ClassMismatchException $e) {
-       die(sprintf("[Main:] Die Reederei <span class=\"exception_reason\">%s</span> kann ihre Werften nicht besch&auml;ftigen. Grund: <span class=\"exception_reason\">%s</span><br />\n",
-               $shipping->getCompanyName(),
-               $e->getMessage()
-       ));
-} catch (NoObjectException $e) {
-       die(sprintf("[Main:] Die Reederei <span class=\"exception_reason\">%s</span> kann ihre Werften nicht besch&auml;ftigen. Grund: <span class=\"exception_reason\">%s</span><br />\n",
-               $shipping->getCompanyName(),
-               $e->getMessage()
-       ));
-}
+$shipping->addShipTypeToAllShipyards("PassengerShip");
 
 // Personal auf die Werften verteilen
-try {
-       $shipping->distributeAllPersonellOnShipyards();
-} catch (NoShipyardsConstructedException $e) {
-       die(sprintf("[Main:] Die Reederei <span class=\"exception_reason\">%s</span> konnte kein Personal den Werften zuteilen. Grund: <span class=\"exception_reason\">%s</span><br />\n",
-               $shipping->getCompanyName(),
-               $e->getMessage()
-       ));
-} catch (ClassMismatchException $e) {
-       die(sprintf("[Main:] Die Reederei <span class=\"exception_reason\">%s</span> konnte kein Personal den Werften zuteilen. Grund: <span class=\"exception_reason\">%s</span><br />\n",
-               $shipping->getCompanyName(),
-               $e->getMessage()
-       ));
-} catch (NullPointerException $e) {
-       die(sprintf("[Main:] Die Reederei <span class=\"exception_reason\">%s</span> konnte kein Personal den Werften zuteilen. Grund: <span class=\"exception_reason\">%s</span><br />\n",
-               $shipping->getCompanyName(),
-               $e->getMessage()
-       ));
-} catch (NoObjectException $e) {
-       die(sprintf("[Main:] Die Reederei <span class=\"exception_reason\">%s</span> konnte kein Personal den Werften zuteilen. Grund: <span class=\"exception_reason\">%s</span><br />\n",
-               $shipping->getCompanyName(),
-               $e->getMessage()
-       ));
-}
+$shipping->distributeAllPersonellOnShipyards();
 
 // Normale Meldung ausgeben
 DebugMiddleware::getInstance()->output(sprintf("Die Reederei <span class=\"exception_reason\">%s</span> besch&auml;ftigt nun ihre <strong>%d</strong> Mitarbeiter in <strong>%d</strong> Werft(en):<br />\n",
@@ -379,67 +252,16 @@ DebugMiddleware::getInstance()->output(sprintf("Die Reederei <span class=\"excep
 
 // Dann nimmt die Reederei ihren ersten Bauauftrag entgegen.
 // Sie muss auch sich selber Bauauftraege erteilen!
-try {
-       $shipping->addNewWorksContract(WorksContract::createWorksContract("PassengerShip", "M/S Poseidon", $shipping));
-} catch (ClassNotFoundException $e) {
-       die(sprintf("[Main:] Der Bauauftrag konnte nicht erstellt werden. Grund: <span class=\"exception_reason\">%s</span><br />\n",
-               $e->getMessage()
-       ));
-} catch (NullPointerException $e) {
-       die(sprintf("[Main:] Der Bauauftrag konnte nicht erstellt werden. Grund: <span class=\"exception_reason\">%s</span><br />\n",
-               $e->getMessage()
-       ));
-} catch (NoObjectException $e) {
-       die(sprintf("[Main:] Der Bauauftrag konnte nicht erstellt werden. Grund: <span class=\"exception_reason\">%s</span><br />\n",
-               $e->getMessage()
-       ));
-} catch (MissingMethodException $e) {
-       die(sprintf("[Main:] Der Bauauftrag konnte nicht erstellt werden. Grund: <span class=\"exception_reason\">%s</span><br />\n",
-               $e->getMessage()
-       ));
-} catch (EmptyStructuresListException $e) {
-       die(sprintf("[Main:] Der Bauauftrag konnte nicht erstellt werden. Grund: <span class=\"exception_reason\">%s</span><br />\n",
-               $e->getMessage()
-       ));
-}
+$shipping->addNewWorksContract(WorksContract::createWorksContract("PassengerShip", "M/S Poseidon", $shipping));
 
 // Auftrag-Instanz holen
 $contract = $shipping->getLastContractInstance();
 
 // Die Reederei hat einen Haendler gewaehlt
-try {
-       $shipping->setMerchantInstance($merchant);
-} catch (NullPointerException $e) {
-       die(sprintf("[Main:] Der H&auml;ndler <span class=\"exception_reason\">%s</span> konnte nicht ausgew&auml;hlt werden. Grund: <span class=\"exception_reason\">%s</span><br />\n",
-               $merchant->getMerchantName(),
-               $e->getMessage()
-       ));
-} catch (NoObjectException $e) {
-       die(sprintf("[Main:] Der H&auml;ndler <span class=\"exception_reason\">%s</span> konnte nicht ausgew&auml;hlt werden. Grund: <span class=\"exception_reason\">%s</span><br />\n",
-               $merchant->getMerchantName(),
-               $e->getMessage()
-       ));
-} catch (ClassMismatchException $e) {
-       die(sprintf("[Main:] Der H&auml;ndler <span class=\"exception_reason\">%s</span> konnte nicht ausgew&auml;hlt werden. Grund: <span class=\"exception_reason\">%s</span><br />\n",
-               $merchant->getMerchantName(),
-               $e->getMessage()
-       ));
-}
+$shipping->setMerchantInstance($merchant);
 
 // Den Bauauftrag mit der Reederei abgleichen, ob sie den Schiffstyp bauen koennen
-try {
-       $typeValid = $shipping->validateWorksContractShipType($contract);
-} catch (NullPointerException $e) {
-       die(sprintf("[Main:] Die Reederei <span class=\"exception_reason\">%s</span> konnte den Bauauftrag nicht validieren. Grund: <span class=\"exception_reason\">%s</span><br />\n",
-               $shipping->getCompanyName(),
-               $e->getMessage()
-       ));
-} catch (NoObjectException $e) {
-       die(sprintf("[Main:] Die Reederei <span class=\"exception_reason\">%s</span> konnte den Bauauftrag nicht validieren. Grund: <span class=\"exception_reason\">%s</span><br />\n",
-               $shipping->getCompanyName(),
-               $e->getMessage()
-       ));
-}
+$typeValid = $shipping->validateWorksContractShipType($contract);
 
 // Kann gebaut werden?
 if ($typeValid) {
@@ -457,25 +279,7 @@ if ($typeValid) {
 
 // Dann den Bauauftrag verfeinern
 foreach ($einbauten['parts'] as $key=>$part) {
-       try {
-               $contract->addContractDetails($key, $einbauten['builds'][$key], $part);
-       } catch (ShipPartNotConstructableException $e) {
-               // Output message
-               die($e->getMessage());
-       } catch (ShipNotConstructedException $e) {
-               // Output message
-               die($e->getMessage());
-       } catch (ItemNotInPriceListException $e) {
-               die(sprintf("[Main:] Der Artikel <span class=\"exception_reason\">%s</span> konnte nicht in der Preisliste gefunden werden. Grund: <span class=\"exception_reason\">%s</span><br />\n",
-                       $key,
-                       $e->getMessage()
-               ));
-       } catch (InvalidArrayCountException $e) {
-               die(sprintf("[Main:] Der Artikel <span class=\"exception_reason\">%s</span> konnte nicht in der Preisliste gefunden werden. Grund: <span class=\"exception_reason\">%s</span><br />\n",
-                       $key,
-                       $e->getMessage()
-               ));
-       }
+       $contract->addContractDetails($key, $einbauten['builds'][$key], $part);
 }
 
 // Reederei-Objekt ausgeben
@@ -496,29 +300,7 @@ unset($key);
 unset($typeValid);
 
 // Gesamtwert ausgeben
-try {
-       $totalValue = $contract->getTotalPrice();
-} catch (NullPointerException $e) {
-       die(sprintf("[Main:] Gesamtbestellwert nicht ermittelbar. Grund: <span class=\"exception_reason\">%s</span><br />\n",
-               $e->getMessage()
-       ));
-} catch (NoObjectException $e) {
-       die(sprintf("[Main:] Gesamtbestellwert nicht ermittelbar. Grund: <span class=\"exception_reason\">%s</span><br />\n",
-               $e->getMessage()
-       ));
-} catch (MissingMethodException $e) {
-       die(sprintf("[Main:] Gesamtbestellwert nicht ermittelbar. Grund: <span class=\"exception_reason\">%s</span><br />\n",
-               $e->getMessage()
-       ));
-} catch (EmptyStructuresListException $e) {
-       die(sprintf("[Main:] Gesamtbestellwert nicht ermittelbar. Grund: <span class=\"exception_reason\">%s</span><br />\n",
-               $e->getMessage()
-       ));
-} catch (TotalPriceNotCalculatedException $e) {
-       die(sprintf("[Main:] Gesamtbestellwert nicht ermittelbar. Grund: <span class=\"exception_reason\">%s</span><br />\n",
-               $e->getMessage()
-       ));
-}
+$totalValue = $contract->getTotalPrice();
 
 // Wert ausgeben
 DebugMiddleware::getInstance()->output(sprintf("Der Bau der <span class=\"exception_reason\">%s</span> wird der Reederei <span class=\"exception_reason\">%s</span> voraussichtlich <span class=\"exception_reason\">%s</span> kosten.<br />\n",
@@ -531,39 +313,7 @@ DebugMiddleware::getInstance()->output(sprintf("Der Bau der <span class=\"except
 unset($totalValue);
 
 // Den Bauvertrag unterschreiben (damit wird er in den Bau-Queue aufgenommen)
-try {
-       $shipping->signContract($contract, $shipping);
-} catch (NullPointerException $e) {
-       die(sprintf("[Main:] The shipping company <span class=\"exception_reason\">%s</span> was not able to sign the contract for the following reason: <span class=\"exception_reason\">%s</span><br />\n",
-               $shipping->getCompanyName(),
-               $e->getMessage()
-       ));
-} catch (NoObjectException $e) {
-       die(sprintf("[Main:] The shipping company <span class=\"exception_reason\">%s</span> was not able to sign the contract for the following reason: <span class=\"exception_reason\">%s</span><br />\n",
-               $shipping->getCompanyName(),
-               $e->getMessage()
-       ));
-} catch (MissingMethodException $e) {
-       die(sprintf("[Main:] The shipping company <span class=\"exception_reason\">%s</span> was not able to sign the contract for the following reason: <span class=\"exception_reason\">%s</span><br />\n",
-               $shipping->getCompanyName(),
-               $e->getMessage()
-       ));
-} catch (InvalidContractPartnerException $e) {
-       die(sprintf("[Main:] The shipping company <span class=\"exception_reason\">%s</span> was not able to sign the contract for the following reason: <span class=\"exception_reason\">%s</span><br />\n",
-               $shipping->getCompanyName(),
-               $e->getMessage()
-       ));
-} catch (ContractAllreadySignedException $e) {
-       die(sprintf("[Main:] The shipping company <span class=\"exception_reason\">%s</span> was not able to sign the contract for the following reason: <span class=\"exception_reason\">%s</span><br />\n",
-               $shipping->getCompanyName(),
-               $e->getMessage()
-       ));
-} catch (WrongContractPartnerException $e) {
-       die(sprintf("[Main:] The shipping company <span class=\"exception_reason\">%s</span> was not able to sign the contract for the following reason: <span class=\"exception_reason\">%s</span><br />\n",
-               $shipping->getCompanyName(),
-               $e->getMessage()
-       ));
-}
+$shipping->signContract($contract, $shipping);
 
 // Meldung ausgeben
 if ($contract->isSigned()) {
@@ -591,17 +341,7 @@ if (defined('DEBUG_CONTRACT_OBJ')) {
 //exit();
 
 // Anzahl Betten ermitteln
-try {
-       $totalBeds = $contract->getShipInstance()->calcTotalBeds();
-} catch (StructuresOutOfBoundsException $e) {
-       die(sprintf("[Main:] Anzahl Betten konnten nicht ermittelt werden. Grund: <span class=\"exception_reason\">%s</span><br />\n",
-               $e->getMessage()
-       ));
-} catch (EmptyStructuresListException $e) {
-       die(sprintf("[Main:] Anzahl Betten konnten nicht ermittelt werden. Grund: <span class=\"exception_reason\">%s</span><br />\n",
-               $e->getMessage()
-       ));
-}
+$totalBeds = $contract->getShipInstance()->calcTotalBeds();
 
 // Bettenanzahl ausgeben
 DebugMiddleware::getInstance()->output(sprintf("Es stehen <strong>%d</strong> Betten zur Verf&uuml;gung.",
index f87b31ae1c49d3b63e87539d187c7310e9e82321..d8e00c62126ef9cebd588cd2b649a74af12db33e 100644 (file)
@@ -1,12 +1,12 @@
 <?php
 // Change directory
-@chdir("../..");
+@chdir('../..');
 
 // Set testing mode (no starter.php will be loaded!)
 define('TEST_MODE', true);
 
 // Load config file
-require(dirname(dirname(dirname(__FILE__))) . "/inc/config.php");
+require(dirname(dirname(dirname(__FILE__))) . '/inc/config.php');
 
 // Load all include files
 require($cfg->readConfig('base_path') . 'inc/includes.php');
@@ -29,69 +29,7 @@ require($cfg->readConfig('base_path') . 'application/ship-simu/loader.php');
 
 // Wir tun hier so, als waere schon das Reederei-Objekt generiert und wir wollen
 // jetzt die Personalliste wiederherstellen
-try {
-       $personell = SimulatorPersonell::createSimulatorPersonellByID('SimulatorPersonell@829292aeca3f6bf78c16e25fc4f75c98');
-} catch (InvalidIDFormatException $e) {
-       die(sprintf("[Main:] Could  not create personal list for follwing reason: <span class=\"exception_reason\">%s</span><br />\n",
-               $e->getMessage()
-       ));
-} catch (InvalidArrayCountException $e) {
-       die(sprintf("[Main:] Could  not create personal list for follwing reason: <span class=\"exception_reason\">%s</span><br />\n",
-               $e->getMessage()
-       ));
-} catch (NullPointerException $e) {
-       die(sprintf("[Main:] Could  not create personal list for follwing reason: <span class=\"exception_reason\">%s</span><br />\n",
-               $e->getMessage()
-       ));
-} catch (NoObjectException $e) {
-       die(sprintf("[Main:] Could  not create personal list for follwing reason: <span class=\"exception_reason\">%s</span><br />\n",
-               $e->getMessage()
-       ));
-} catch (MissingMethodException $e) {
-       die(sprintf("[Main:] Could  not create personal list for follwing reason: <span class=\"exception_reason\">%s</span><br />\n",
-               $e->getMessage()
-       ));
-} catch (FileIsEmptyException $e) {
-       die(sprintf("[Main:] Could  not create personal list for follwing reason: <span class=\"exception_reason\">%s</span><br />\n",
-               $e->getMessage()
-       ));
-} catch (FilePointerNotOpenedException $e) {
-       die(sprintf("[Main:] Could  not create personal list for follwing reason: <span class=\"exception_reason\">%s</span><br />\n",
-               $e->getMessage()
-       ));
-} catch (InvalidArrayCountException $e) {
-       die(sprintf("[Main:] Could  not create personal list for follwing reason: <span class=\"exception_reason\">%s</span><br />\n",
-               $e->getMessage()
-       ));
-} catch (InvalidMD5ChecksumException $e) {
-       die(sprintf("[Main:] Could  not create personal list for follwing reason: <span class=\"exception_reason\">%s</span><br />\n",
-               $e->getMessage()
-       ));
-} catch (InvalidDataLengthException $e) {
-       die(sprintf("[Main:] Could  not create personal list for follwing reason: <span class=\"exception_reason\">%s</span><br />\n",
-               $e->getMessage()
-       ));
-} catch (InvalidSimulatorIDException $e) {
-       die(sprintf("[Main:] Could  not create personal list for follwing reason: <span class=\"exception_reason\">%s</span><br />\n",
-               $e->getMessage()
-       ));
-} catch (MismatchingCompressorsException $e) {
-       die(sprintf("[Main:] Could  not create personal list for follwing reason: <span class=\"exception_reason\">%s</span><br />\n",
-               $e->getMessage()
-       ));
-} catch (ContainerItemIsNullException $e) {
-       die(sprintf("[Main:] Could  not create personal list for follwing reason: <span class=\"exception_reason\">%s</span><br />\n",
-               $e->getMessage()
-       ));
-} catch (ContainerItemIsNoArrayException $e) {
-       die(sprintf("[Main:] Could  not create personal list for follwing reason: <span class=\"exception_reason\">%s</span><br />\n",
-               $e->getMessage()
-       ));
-} catch (ContainerMaybeDamagedException $e) {
-       die(sprintf("[Main:] Could  not create personal list for follwing reason: <span class=\"exception_reason\">%s</span><br />\n",
-               $e->getMessage()
-       ));
-}
+$personell = SimulatorPersonell::createSimulatorPersonellByID('SimulatorPersonell@829292aeca3f6bf78c16e25fc4f75c98');
 
 // Personal-Objekt debuggen
 if (defined('DEBUG_PERSONELL_OBJ')) {
@@ -105,21 +43,7 @@ if (defined('DEBUG_PERSONELL_OBJ')) {
 exit();
 
 // Etwas zum Testen...
-try {
-       $personell = SimulatorPersonell::createSimulatorPersonell(20);
-} catch (NullPointerException $e) {
-       die(sprintf("[Main:] Personal list not created for following reason: <span class=\"exception_reason\">%s</span><br />\n",
-               $e->getMessage()
-       ));
-} catch (NoObjectException $e) {
-       die(sprintf("[Main:] Personal list not created for following reason: <span class=\"exception_reason\">%s</span><br />\n",
-               $e->getMessage()
-       ));
-} catch (MissingMethodException $e) {
-       die(sprintf("[Main:] Personal list not created for following reason: <span class=\"exception_reason\">%s</span><br />\n",
-               $e->getMessage()
-       ));
-}
+$personell = SimulatorPersonell::createSimulatorPersonell(20);
 
 // Personal-Objekt debuggen
 if (defined('DEBUG_PERSONELL_OBJ')) {
@@ -130,33 +54,7 @@ if (defined('DEBUG_PERSONELL_OBJ')) {
 }
 
 // Try to save the object (for testing purposes)
-try {
-       $personell->saveObjectToDatabase();
-} catch (NullPointerException $e) {
-       die(sprintf("[Main:] Object not saved for following reason: <span class=\"exception_reason\">%s</span><br />\n",
-               $e->getMessage()
-       ));
-} catch (NoObjectException $e) {
-       die(sprintf("[Main:] Object not saved for following reason: <span class=\"exception_reason\">%s</span><br />\n",
-               $e->getMessage()
-       ));
-} catch (InvalidObjectException $e) {
-       die(sprintf("[Main:] Object not saved for following reason: <span class=\"exception_reason\">%s</span><br />\n",
-               $e->getMessage()
-       ));
-} catch (MissingMethodException $e) {
-       die(sprintf("[Main:] Object not saved for following reason: <span class=\"exception_reason\">%s</span><br />\n",
-               $e->getMessage()
-       ));
-} catch (UnsupportedLimitationPartException $e) {
-       die(sprintf("[Main:] Object not saved for following reason: <span class=\"exception_reason\">%s</span><br />\n",
-               $e->getMessage()
-       ));
-} catch (InvalidArrayCountException $e) {
-       die(sprintf("[Main:] Object not saved for following reason: <span class=\"exception_reason\">%s</span><br />\n",
-               $e->getMessage()
-       ));
-}
+$personell->saveObjectToDatabase();
 
 //
 ?>
index 622c2c79819676d9b9a0b1362d99e73dcd4f996a..c09ae48c932bacf9e1aeb32e0521e769ff159417 100644 (file)
@@ -1,12 +1,12 @@
 <?php
 // Change directory
-@chdir("../..");
+@chdir('../..');
 
 // Set testing mode (no starter.php will be loaded!)
 define('TEST_MODE', true);
 
 // Load config file
-require(dirname(dirname(dirname(__FILE__))) . "/inc/config.php");
+require(dirname(dirname(dirname(__FILE__))) . '/inc/config.php');
 
 // Load all include files
 require($cfg->readConfig('base_path') . 'inc/includes.php');
@@ -29,69 +29,7 @@ require($cfg->readConfig('base_path') . 'application/ship-simu/loader.php');
 
 // Wir tun hier so, als waere schon das Reederei-Objekt generiert und wir wollen
 // jetzt die Personalliste wiederherstellen
-try {
-       $personell = SimulatorPersonell::createSimulatorPersonellByID('SimulatorPersonell@829292aeca3f6bf78c16e25fc4f75c98');
-} catch (InvalidIDFormatException $e) {
-       die(sprintf("[Main:] Could  not create personal list for follwing reason: <span class=\"exception_reason\">%s</span><br />\n",
-               $e->getMessage()
-       ));
-} catch (InvalidArrayCountException $e) {
-       die(sprintf("[Main:] Could  not create personal list for follwing reason: <span class=\"exception_reason\">%s</span><br />\n",
-               $e->getMessage()
-       ));
-} catch (NullPointerException $e) {
-       die(sprintf("[Main:] Could  not create personal list for follwing reason: <span class=\"exception_reason\">%s</span><br />\n",
-               $e->getMessage()
-       ));
-} catch (NoObjectException $e) {
-       die(sprintf("[Main:] Could  not create personal list for follwing reason: <span class=\"exception_reason\">%s</span><br />\n",
-               $e->getMessage()
-       ));
-} catch (MissingMethodException $e) {
-       die(sprintf("[Main:] Could  not create personal list for follwing reason: <span class=\"exception_reason\">%s</span><br />\n",
-               $e->getMessage()
-       ));
-} catch (FileIsEmptyException $e) {
-       die(sprintf("[Main:] Could  not create personal list for follwing reason: <span class=\"exception_reason\">%s</span><br />\n",
-               $e->getMessage()
-       ));
-} catch (FilePointerNotOpenedException $e) {
-       die(sprintf("[Main:] Could  not create personal list for follwing reason: <span class=\"exception_reason\">%s</span><br />\n",
-               $e->getMessage()
-       ));
-} catch (InvalidArrayCountException $e) {
-       die(sprintf("[Main:] Could  not create personal list for follwing reason: <span class=\"exception_reason\">%s</span><br />\n",
-               $e->getMessage()
-       ));
-} catch (InvalidMD5ChecksumException $e) {
-       die(sprintf("[Main:] Could  not create personal list for follwing reason: <span class=\"exception_reason\">%s</span><br />\n",
-               $e->getMessage()
-       ));
-} catch (InvalidDataLengthException $e) {
-       die(sprintf("[Main:] Could  not create personal list for follwing reason: <span class=\"exception_reason\">%s</span><br />\n",
-               $e->getMessage()
-       ));
-} catch (InvalidSimulatorIDException $e) {
-       die(sprintf("[Main:] Could  not create personal list for follwing reason: <span class=\"exception_reason\">%s</span><br />\n",
-               $e->getMessage()
-       ));
-} catch (MismatchingCompressorsException $e) {
-       die(sprintf("[Main:] Could  not create personal list for follwing reason: <span class=\"exception_reason\">%s</span><br />\n",
-               $e->getMessage()
-       ));
-} catch (ContainerItemIsNullException $e) {
-       die(sprintf("[Main:] Could  not create personal list for follwing reason: <span class=\"exception_reason\">%s</span><br />\n",
-               $e->getMessage()
-       ));
-} catch (ContainerItemIsNoArrayException $e) {
-       die(sprintf("[Main:] Could  not create personal list for follwing reason: <span class=\"exception_reason\">%s</span><br />\n",
-               $e->getMessage()
-       ));
-} catch (ContainerMaybeDamagedException $e) {
-       die(sprintf("[Main:] Could  not create personal list for follwing reason: <span class=\"exception_reason\">%s</span><br />\n",
-               $e->getMessage()
-       ));
-}
+$personell = SimulatorPersonell::createSimulatorPersonellByID('SimulatorPersonell@829292aeca3f6bf78c16e25fc4f75c98');
 
 // Personal-Objekt debuggen
 if (defined('DEBUG_PERSONELL_OBJ')) {
@@ -105,21 +43,7 @@ if (defined('DEBUG_PERSONELL_OBJ')) {
 exit();
 
 // Etwas zum Testen...
-try {
-       $personell = SimulatorPersonell::createSimulatorPersonell(20);
-} catch (NullPointerException $e) {
-       die(sprintf("[Main:] Personal list not created for following reason: <span class=\"exception_reason\">%s</span><br />\n",
-               $e->getMessage()
-       ));
-} catch (NoObjectException $e) {
-       die(sprintf("[Main:] Personal list not created for following reason: <span class=\"exception_reason\">%s</span><br />\n",
-               $e->getMessage()
-       ));
-} catch (MissingMethodException $e) {
-       die(sprintf("[Main:] Personal list not created for following reason: <span class=\"exception_reason\">%s</span><br />\n",
-               $e->getMessage()
-       ));
-}
+$personell = SimulatorPersonell::createSimulatorPersonell(20);
 
 // Personal-Objekt debuggen
 if (defined('DEBUG_PERSONELL_OBJ')) {
@@ -130,33 +54,7 @@ if (defined('DEBUG_PERSONELL_OBJ')) {
 }
 
 // Try to save the object (for testing purposes)
-try {
-       $personell->saveObjectToDatabase();
-} catch (NullPointerException $e) {
-       die(sprintf("[Main:] Object not saved for following reason: <span class=\"exception_reason\">%s</span><br />\n",
-               $e->getMessage()
-       ));
-} catch (NoObjectException $e) {
-       die(sprintf("[Main:] Object not saved for following reason: <span class=\"exception_reason\">%s</span><br />\n",
-               $e->getMessage()
-       ));
-} catch (InvalidObjectException $e) {
-       die(sprintf("[Main:] Object not saved for following reason: <span class=\"exception_reason\">%s</span><br />\n",
-               $e->getMessage()
-       ));
-} catch (MissingMethodException $e) {
-       die(sprintf("[Main:] Object not saved for following reason: <span class=\"exception_reason\">%s</span><br />\n",
-               $e->getMessage()
-       ));
-} catch (UnsupportedLimitationPartException $e) {
-       die(sprintf("[Main:] Object not saved for following reason: <span class=\"exception_reason\">%s</span><br />\n",
-               $e->getMessage()
-       ));
-} catch (InvalidArrayCountException $e) {
-       die(sprintf("[Main:] Object not saved for following reason: <span class=\"exception_reason\">%s</span><br />\n",
-               $e->getMessage()
-       ));
-}
+$personell->saveObjectToDatabase();
 
 //
 ?>