Minor code improvements:
authorRoland Häder <roland@mxchange.org>
Tue, 1 Jul 2008 13:07:54 +0000 (13:07 +0000)
committerRoland Häder <roland@mxchange.org>
Tue, 1 Jul 2008 13:07:54 +0000 (13:07 +0000)
- A lot else statements rewritten
- Typos fixed

16 files changed:
application/ship-simu/exceptions/class_NoShipyardsConstructedException.php
application/ship-simu/main/companies/class_ShippingCompany.php
application/ship-simu/main/personell/class_SimulatorPersonell.php
application/ship-simu/main/personell/company/class_CompanyEmployee.php
application/ship-simu/main/ships/class_BaseShip.php
application/ship-simu/main/ships/passenger/class_PassengerShip.php
application/ship-simu/templates/de/code/action_login_company.ctp
inc/classes/main/class_BaseFrameworkSystem.php
inc/classes/main/crypto/class_CryptoHelper.php
inc/classes/main/filter/auth/class_UserAuthFilter.php
inc/classes/main/io/class_FrameworkFileInputPointer.php
inc/classes/main/mailer/debug/class_DebugMailer.php
inc/classes/main/output/class_ConsoleOutput.php
inc/classes/main/resolver/controller/class_BaseControllerResolver.php
inc/classes/main/resolver/controller/image/class_ImageControllerResolver.php
inc/config/class_FrameworkConfiguration.php

index 228e2dd16f74cfaef766ff829de903b32cf14654..03245b30bdc7782db878157bbfb293af2f5173af 100644 (file)
  */
 class NoShipyardsConstructedException extends FrameworkException {
        public function __construct (FrameworkInterface $class, $code) {
+               // No class given
+               $message = sprintf("Please provide a class for <span id=\"exception_reason\">%s</span>", __CLASS__);
                if (is_object($class)) {
                        // Add a message around the missing class
                        $message = sprintf("[%s:] Keine Werften gefunden!",
                                $class->__toString()
                        );
-               } else {
-                       // No class given
-                       $message = sprintf("Please provide a class for <span id=\"exception_reason\">%s</span>", __CLASS__);
-               }
+               } // END - if
 
                // Call parent constructor
                parent::__construct($message, $code);
index 1eef86b61c9afa4b5a8b120409ebc982b8f40707..7549af4056c7d5ac0e58a13385f8d89b3d974848 100644 (file)
@@ -331,14 +331,14 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner
                                $iterator->seek($pos);
 
                                // Is the current position valid?
-                               if ($iterator->valid()) {
-                                       // Element holen
-                                       $employee = $iterator->current();
-                               } else {
+                               if (!$iterator->valid()) {
                                        // Should normally not happen... :(
                                        throw new StructuresOutOfBoundsException($idx, self::EXCEPTION_INDEX_OUT_OF_BOUNDS);
-                               }
-                       }
+                               } // END - if
+
+                               // Get current element
+                               $employee = $iterator->current();
+                       } // END - while
 
                        // A dummy just for the description and real class
                        $dummy = CompanyEmployee::createCompanyEmployee("", "", "M", 1970, 1, 1, $employee->isMarried(), 0);
index 1021c569e30606308eee49574cd76248211a482f..91916e580b1d80d3237ffa5181a057be68476fbc 100644 (file)
@@ -129,20 +129,20 @@ class SimulatorPersonell extends BasePersonell {
         * @throws      MissingSimulatorIdException             If an ID number was not found
         */
        public final static function createSimulatorPersonellByID ($idNumber) {
+               // Use the direct ID number
+               $tempID = $idNumber;
+
                // Add the class name if it was not found
                if (count(explode("@", $idNumber)) < 2) {
                        // Add class name in front of the incomplete ID number
                        $tempID = sprintf("%s@%s", __CLASS__, $idNumber);
-               } else {
-                       // Use the direct ID number
-                       $tempID = $idNumber;
-               }
+               } // END - if
 
                // Validate the ID number
                if (!preg_match(sprintf("/%s\@([a-f0-9]){32}/i", __CLASS__), $tempID)) {
                        // Invalid format
                        throw new InvalidIDFormatException(new SimulatorPersonell(), self::EXCEPTION_ID_IS_INVALID_FORMAT);
-               }
+               } // END - if
 
                // Get instance
                $personellInstance = new SimulatorPersonell(false);
@@ -154,7 +154,7 @@ class SimulatorPersonell extends BasePersonell {
                if (!$dbInstance->isUniqueIdUsed($tempID))  {
                        // Entry not found!
                        throw new MissingSimulatorIdException(array($personellInstance, $idNumber), self::EXCEPTION_SIMULATOR_ID_INVALID);
-               }
+               } // END - if
 
                // Load the personell list and add it to this object
                $personellInstance->loadPersonellList($tempID);
@@ -176,15 +176,18 @@ class SimulatorPersonell extends BasePersonell {
 
        // Create personell list
        public function createPersonellList () {
-               if (is_null($this->personellList)) {
-                       $this->personellList = new FrameworkArrayObject("FakedPersonellList");
-               } else {
+               // Is the list already created?
+               if ($this->personelllList instanceof FrameworkArrayObject) {
+                       // Throw an exception
                        throw new PersonellListAlreadyCreatedException($this, self::EXCEPTION_DIMENSION_ARRAY_INVALID);
-               }
+               } // END - if
+
+               // Initialize the array
+               $this->personellList = new FrameworkArrayObject("FakedPersonellList");
        }
 
        // Remove the personell list
-       private function removePersonellList () {
+       private final function removePersonellList () {
                unset($this->personellList);
        }
 
index 32d2abe80b50c2380fe3a50c1d97f7df6484db59..52a4d241340452b9054a378fa4906de285470593 100644 (file)
@@ -56,14 +56,14 @@ class CompanyEmployee extends SimulatorPersonell {
                }
 
                // Ist the given birthday valid?
-               if ($personellInstance->isDateValid($year, $month, $day)) {
-                       // Set birthday
-                       $personellInstance->setBirthday($year, $month, $day);
-               } else {
+               if (!$personellInstance->isDateValid($year, $month, $day)) {
                        // Something is wrong ...
                        throw new BirthdayInvalidException(array($year, $month, $day), self::EXCEPTION_BIRTH_DATE_IS_INVALID);
                }
 
+               // Set birthday
+               $personellInstance->setBirthday($year, $month, $day);
+
                // Set as employed/marrital status
                $personellInstance->setEmployed(true);
                $personellInstance->setMarried($married);
index 51f1559d947e4b9ed1f7c300d8b9dee68230187c..b72af8ade74f41ce909556f4085e0574c562a39c 100644 (file)
@@ -70,13 +70,13 @@ class BaseShip extends BaseSimulator {
                ));
 
                // Ist die gewuenschte Klasse vorhanden?
-               if (class_exists($partClass)) {
-                       // Get an instance back from our object factory
-                       $partInstance = ObjectFactory::createObjectByName($partClass);
-               } else {
+               if (!class_exists($partClass)) {
                        // Nicht vorhanden, dann Ausnahme werfen!
                        throw new ClassNotFoundException($partClass, self::EXCEPTION_CLASS_NOT_FOUND);
-               }
+               } // END - if
+
+               // Get an instance back from our object factory
+               $partInstance = ObjectFactory::createObjectByName($partClass);
 
                // Das Einbauen versuchen...
                try {
index 4e8b1300e39636314cd1a5d7d4e02db679206436..39f50db78d00aadf707f3b685d5ce79d5bfcb1d7 100644 (file)
@@ -43,15 +43,7 @@ class PassengerShip extends BaseShip implements ConstructableShip {
                // Get new instance
                $passInstance = new PassengerShip();
 
-               // Debug message
-               if ((defined('DEBUG_SHIP')) || (defined('DEBUG_ALL'))) {
-                       $passInstance->debugOutput(sprintf("[%s:%d] Ein Passagier-Schiff wird erstellt.",
-                               __CLASS__,
-                               __LINE__
-                       ));
-               } // END - if
-
-               // Set ship's name
+               // Set ship name
                $passInstance->setShipName($shipName);
 
                // Instanz zurueckgeben
@@ -59,7 +51,7 @@ class PassengerShip extends BaseShip implements ConstructableShip {
        }
 
        // Anzahl Betten ermitteln
-       final function calcTotalBeds () {
+       public final function calcTotalBeds () {
                // Struktur-Array holen
                $struct = $this->getStructuresArray();
 
@@ -90,34 +82,11 @@ class PassengerShip extends BaseShip implements ConstructableShip {
                                        if (!is_null($cab)) {
                                                // Kabinenbeschreibung holen
                                                $cabType = $cab->getObjectDescription();
-                                       }
-
-                                       // Debug-Meldung ausgeben
-                                       $this->debugOutput(sprintf("[%s:%d] Es stehen <strong>%d</strong> Betten vom Kabinen-Typ <strong>%s</strong> bereit.",
-                                               __CLASS__,
-                                               __LINE__,
-                                               $total,
-                                               $cabType
-                                       ));
-                               }
-                       } else {
-                               // Keine Kabine!
-                               if ((defined('DEBUG_SHIP')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] <strong>%s</strong> ist keine Kabine.",
-                                       __CLASS__,
-                                       __LINE__,
-                                       $el->getObjectDescription()
-                               ));
-                       }
+                                       } // END - if
+                               } // END - if
+                       } // END - if
                } // END - for
 
-               if ((defined('DEBUG_SHIP')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Das <strong>%s</strong> mit dem Namen <strong>%s</strong> hat <strong>%d</strong> Betten.",
-                       __CLASS__,
-                       __LINE__,
-                       $this->getObjectDescription(),
-                       $this->getShipName(),
-                       $numBeds
-               ));
-
                // Anzahl zurueckliefern
                return $numBeds;
        }
index 2747805349d10adc7857a36fdfb69c8dae972538..7eacc4b6d415421cacebb9d70147b5592ca08b5a 100644 (file)
@@ -8,9 +8,9 @@ $linkInstance->prefetchValueInstance('user');
 // Maximum of allowed companies reached?
 if ($linkInstance->getValueInstance()->ifUserCreatedMaximumAllowedCompanies()) {
        // No more companies allowed to create
-} elseif ($linkInstance->getValueInstance()->ifUserPointsEnougth('found_new_company')) {
+} elseif ($linkInstance->getValueInstance()->ifUserPointsEnough('found_new_company')) {
        // Enough money to found company
-} elseif ($linkInstance->getValueInstance()->ifUserPointsEnougth('write_applications')) {
+} elseif ($linkInstance->getValueInstance()->ifUserPointsEnough('write_applications')) {
        // Enough money to write applications to other companies
 } elseif ($linkInstance->getValueInstance()->ifGovermentPaysStartupHelp()) {
        // Display link to goverment for startup help
index 4a6eb893e0418d524b38ba71681d6e859dc27db6..96338267adb4d54441d2007c7bff657c441b6610 100644 (file)
@@ -480,11 +480,16 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
         * @return      $dbInstance     The database layer instance
         */
        public final function getDatabaseInstance () {
+               // Default is invalid db instance
+               $dbInstance = null;
+
+               // Is the registry there and initialized?
                if ((class_exists('Registry')) && (Registry::isInitialized() === true)) {
-                       return Registry::getRegistry()->getInstance('dbInstance');
-               } else {
-                       return null;
-               }
+                       $dbInstance = Registry::getRegistry()->getInstance('dbInstance');
+               } // END - if
+
+               // Return instance
+               return $dbInstance;
        }
 
        /**
@@ -721,11 +726,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
         * @return      $objectDescription      The description of this simulation part
         */
        public final function getObjectDescription () {
-               if (isset($this->objectDescription)) {
-                       return $this->objectDescription;
-               } else {
-                       return null;
-               }
+               return $this->objectDescription;
        }
 
        /**
@@ -750,7 +751,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
 
        /**
         * Compare if both simulation part description and class name matches
-        * (shall be enougth)
+        * (shall be enough)
         *
         * @param       $itemInstance   An object instance to an other class
         * @return      boolean                 The result of comparing class name simulation part description
index d1b7e87c6879c8487bfe5bd41cc55d7016de4dac..4583bd7de738db4794f39589d912af7202e322e6 100644 (file)
@@ -136,17 +136,17 @@ class CryptoHelper extends BaseFrameworkSystem implements Cryptable {
                // Cast the string
                $str = (string) $str;
 
+               // Default is the default salt ;-)
+               $salt = $this->salt;
+
                // Is the old password set?
-               if (empty($oldHash)) {
-                       // No, then use the current salt
-                       $salt = $this->salt;
-               } else {
+               if (!empty($oldHash)) {
                        // Use the salt from hash, first get length
                        $length = $this->getConfigInstance()->readConfig('salt_length');
 
                        // Then extract the X first characters from the hash as our salt
                        $salt = substr($oldHash, 0, $length);
-               }
+               } // END - if
 
                // Hash the password with salt
                //* DEBUG: */ echo "salt=".$salt."/plain=".$str."<br />\n";
index 572d2b0f2eb1df4ac542af6baec01ae071c122d4..5c871cd1c3938dd3fe294b7e79d930092dd9172e 100644 (file)
@@ -107,16 +107,16 @@ class UserAuthFilter extends BaseFilter implements Filterable {
                        throw new UserAuthorizationException($this, self::EXCEPTION_AUTH_DATA_INVALID);
                } // END - if
 
+               // Regular user account
+               $className = $this->getConfigInstance()->readConfig('user_class');
+               $methodName = 'createMemberByUserName';
+
                // Now, try to get a user or guest instance
                if ($authLogin == $this->getConfigInstance()->readConfig('guest_login_user')) {
                        // Set class
                        $className = $this->getConfigInstance()->readConfig('guest_class');
                        $methodName = 'createGuestByUserName';
-               } else {
-                       // Regular user account
-                       $className = $this->getConfigInstance()->readConfig('user_class');
-                       $methodName = 'createMemberByUserName';
-               }
+               } // END - if
 
                // Does the guest class exist?
                if (!class_exists($className)) {
index 0e070be17fc46d2e8e5c530706ee6a8a215acc54..4cefaaf34d222bbbdba43e81e885890d14526001 100644 (file)
@@ -34,6 +34,8 @@ class FrameworkFileInputPointer extends BaseFrameworkSystem {
 
        /**
         * Protected constructor
+        *
+        * @return      void
         */
        protected function __construct () {
                // Call parent constructor
@@ -51,6 +53,8 @@ class FrameworkFileInputPointer extends BaseFrameworkSystem {
 
        /**
         * Destructor for cleaning purposes, etc
+        *
+        * @return      void
         */
        public final function __destruct() {
                // Is there a resource pointer? Then we have to close the file here!
@@ -67,11 +71,10 @@ class FrameworkFileInputPointer extends BaseFrameworkSystem {
         * Create a file pointer based on the given file. The file will also
         * be verified here.
         *
-        * @param               $fileName                               The file name we shall pass
-        *                                                              to fopen()
+        * @param               $fileName       The file name we shall pass to fopen()
         * @throws      FileIsEmptyException    If the provided file name is empty.
-        * @throws      FilePointerNotOpenedException           If fopen() returns not a
-        *                                                                              file resource
+        * @throws      FilePointerNotOpenedException   If fopen() returns not a
+        *                                                                                      file resource
         * @return      void
         */
        public final static function createFrameworkFileInputPointer ($fileName) {
@@ -110,7 +113,7 @@ class FrameworkFileInputPointer extends BaseFrameworkSystem {
         *
         * @return      mixed   The result of fread()
         * @throws      NullPointerException    If the file pointer instance
-        *                                                              is not set by setPointer()
+        *                                                                      is not set by setPointer()
         * @throws      InvalidFileResourceException    If there is being set
         *                                                                      an invalid file resource
         */
@@ -132,7 +135,7 @@ class FrameworkFileInputPointer extends BaseFrameworkSystem {
         *
         * @return      mixed   The result of fread()
         * @throws      NullPointerException    If the file pointer instance
-        *                                                              is not set by setPointer()
+        *                                                                      is not set by setPointer()
         * @throws      InvalidFileResourceException    If there is being set
         *                                                                      an invalid file resource
         */
@@ -155,7 +158,7 @@ class FrameworkFileInputPointer extends BaseFrameworkSystem {
         *
         * @return      void
         * @throws      NullPointerException    If the file pointer instance
-        *                                                              is not set by setPointer()
+        *                                                                      is not set by setPointer()
         * @throws      InvalidFileResourceException    If there is being set
         */
        public function closeFile () {
@@ -176,7 +179,7 @@ class FrameworkFileInputPointer extends BaseFrameworkSystem {
        /**
         * Setter for the file pointer
         *
-        * @param               $filePointer    File resource
+        * @param       $filePointer    File resource
         * @return      void
         */
        public final function setPointer ($filePointer) {
@@ -194,7 +197,7 @@ class FrameworkFileInputPointer extends BaseFrameworkSystem {
         * Getter for the file pointer
         *
         * @return      $filePointer    The file pointer which shall be a valid
-        *                                              file resource
+        *                                                      file resource
         */
        public final function getPointer () {
                return $this->filePointer;
@@ -203,7 +206,7 @@ class FrameworkFileInputPointer extends BaseFrameworkSystem {
        /**
         * Setter for file name
         *
-        * @param               $fileName               The new file name
+        * @param       $fileName       The new file name
         * @return      void
         */
        public final function setFileName ($fileName) {
@@ -214,7 +217,7 @@ class FrameworkFileInputPointer extends BaseFrameworkSystem {
        /**
         * Getter for file name
         *
-        * @return      $fileName               The current file name
+        * @return      $fileName       The current file name
         */
        public final function getFileName () {
                return $this->fileName;
index 9e2aea10a43d54312d1a83b1373064dcda1c2f13..171c56514a333cd69e68ad7de13a12bcfe878a63 100644 (file)
@@ -68,6 +68,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 +79,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());
+
+                               // 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
 
-                                       // 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
+                               // 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
 
-                                               // Get the field from the value instance
-                                               $fieldValue = $recipientList['values'][$variable]->getField($variable);
+                                       // Get the field from the value instance
+                                       $fieldValue = $recipientList['values'][$variable]->getField($variable);
 
-                                               // Set it in the template engine
-                                               $templateInstance->assignVariable($variable, $fieldValue);
-                                       }
+                                       // Set it in the template engine
+                                       $templateInstance->assignVariable($variable, $fieldValue);
+                               }
 
-                                       // Render the content
-                                       $templateInstance->renderXmlContent();
+                               // Render the content
+                               $templateInstance->renderXmlContent();
 
-                                       // Get responce instance
-                                       $responseInstance = $this->getApplicationInstance()->getResponseInstance();
+                               // Get responce instance
+                               $responseInstance = $this->getApplicationInstance()->getResponseInstance();
 
-                                       // Transfer the data to the response
-                                       $this->getTemplateInstance()->transferToResponse($responseInstance);
-                               } else {
-                                       // Invalid entry found!
-                                       $this->partialStub("Handling of invalid recipient entries not yet finished.");
-                               }
+                               // Transfer the data to the response
+                               $this->getTemplateInstance()->transferToResponse($responseInstance);
                        } // END - foreach
                } // END - foreach
        }
index 6c9e0fef82c4544c492c223e87db402cdd45c3f1..ff2ad10cfad4f6a8fe867a39bdbe82ccfa3ad4f5 100644 (file)
@@ -52,8 +52,8 @@ class ConsoleOutput extends BaseFrameworkSystem implements OutputStreamer {
        /**
         * Create a new web output system and set the content type
         *
-        * @param               $contentType            A valid content-type
-        * @return      $debugInstance          An instance of this middleware class
+        * @param       $contentType    A valid content-type
+        * @return      $debugInstance  An instance of this middleware class
         */
        public final static function createConsoleOutput ($contentType) {
                // Cast the content-type to string
@@ -77,7 +77,7 @@ class ConsoleOutput extends BaseFrameworkSystem implements OutputStreamer {
        /**
         * Getter for an instance of this class
         *
-        * @return      $consoleInstance                An instance of this class
+        * @return      $consoleInstance        An instance of this class
         */
        public final static function getInstance() {
                if (is_null(self::$consoleInstance)) {
@@ -90,7 +90,7 @@ class ConsoleOutput extends BaseFrameworkSystem implements OutputStreamer {
        /**
         * Output the code
         *
-        * @param               $outStream      Something we shall sent to the console
+        * @param       $outStream      Something we shall sent to the console
         * @return      void
         */
        public final function output ($outStream=false) {
@@ -108,8 +108,8 @@ class ConsoleOutput extends BaseFrameworkSystem implements OutputStreamer {
        /**
         * Assigns a variable for output
         *
-        * @param               $var            The variable we shall assign
-        * @param               $value  The value to store in the variable
+        * @param       $var    The variable we shall assign
+        * @param       $value  The value to store in the variable
         * @return      void
         */
        public function assignVariable ($var, $value) {
index c34d5cab9197512b9f1a62dadf462947543951d2..2548b4f702fceb914c7cf1702ab514cd10cc0835 100644 (file)
@@ -106,10 +106,10 @@ class BaseControllerResolver extends BaseResolver {
                                // Do we have news?
                                if ($this->getConfigInstance()->readConfig('page_with_news') == $this->getApplicationInstance()->getRequestInstance()->getRequestElement('page')) {
                                        // Yes, display news in home then set default controller with news
-                                       $this->setClassName($this->controllerPrefix.'DefaultNewsController');
+                                       $this->setClassName($this->controllerPrefix . 'DefaultNewsController');
                                } else {
                                        // No news at home page or non-news page
-                                       $this->setClassName($this->controllerPrefix.'DefaultController');
+                                       $this->setClassName($this->controllerPrefix . 'DefaultController');
                                }
                        } else {
                                // All is tried, give it up here
index 6ec8fc4c6857c14f886988d16fa8eb2551202df9..c10a4c6513b14a91e5325fe038896306a16b16f6 100644 (file)
@@ -136,7 +136,7 @@ class ImageControllerResolver extends BaseControllerResolver implements Controll
                $controllerInstance = null;
 
                // Default controller
-               $this->setClassName('ImageDefaultController');
+               $this->setClassName($defaultController);
 
                // Generate the class name
                //* DEBUG: */ echo __METHOD__.": Controller=".$controllerName;
@@ -145,10 +145,7 @@ class ImageControllerResolver extends BaseControllerResolver implements Controll
                        $this->setClassName(sprintf("Image%sController",
                                $this->convertToClassName($controllerName)
                        ));
-               } else {
-                       // Default controller
-                       $this->setClassName('ImageDefaultController');
-               }
+               } // END - if
                //* DEBUG: */ echo ", controller=".$this->getClassName()."<br />\n";
 
                // Is this class loaded?
index 74c9416c91fc28c62e9bbfefd171c06cf9c5882f..117836175e37a674285e571e74cbe88c861a1a6a 100644 (file)
@@ -133,14 +133,14 @@ class FrameworkConfiguration implements Registerable {
 
                                // Is the file name really set?
                                if (!empty($inc)) {
+                                       // Base path is by default added
+                                       $fqfn = $inc;
+
                                        // Base path added? (Uni* / Windows)
                                        if ((substr($inc, 0, 1) != "/") && (substr($inc, 1, 1) != ":")) {
                                                // Generate FQFN
                                                $fqfn = sprintf("%s/inc/extra/%s", PATH, $inc);
-                                       } else {
-                                               // Base path is already added
-                                               $fqfn = $inc;
-                                       }
+                                       } // END - if
                                } // END - if
 
                                // Include them all here
@@ -157,18 +157,15 @@ class FrameworkConfiguration implements Registerable {
         */
        public function defineDatabaseType ($type) {
                // Is it defined or not?
-               if (!defined('_DB_TYPE')) {
-                       // Cast to string
-                       $type = (string) $type;
-
-                       // Set the constant
-                       define('_DB_TYPE', $type);
-               } else {
+               if (defined('_DB_TYPE')) {
                        // Already defined! But we cannot throw an exception here... :(
                        ApplicationEntryPoint::app_die(sprintf("[%s:] Please define the database type only once in your application!",
                                __CLASS__
                        ));
                }
+
+               // Set the constant
+               define('_DB_TYPE', (string) $type);
        }
 
        /**
@@ -190,15 +187,15 @@ class FrameworkConfiguration implements Registerable {
                        ApplicationEntryPoint::app_die(sprintf("[%s:] Invalid path (not found) specified. Please make sure it is created.",
                                __CLASS__
                        ));
-               } elseif (!defined('PATH')) {
-                       // Set the constant
-                       define('PATH', $path);
-               } else {
+               } elseif (defined('PATH')) {
                        // Already defined! But we cannot throw an exception here... :(
                        ApplicationEntryPoint::app_die(sprintf("[%s:] Please define the local file path only once in your application.",
                                __CLASS__
                        ));
                }
+
+               // Define path here
+               define('PATH', $path);
        }
 
        /**