Deprecated methods removed/purged
authorRoland Häder <roland@mxchange.org>
Wed, 27 Aug 2008 18:51:59 +0000 (18:51 +0000)
committerRoland Häder <roland@mxchange.org>
Wed, 27 Aug 2008 18:51:59 +0000 (18:51 +0000)
12 files changed:
application/ship-simu/main/class_Merchant.php
application/ship-simu/main/filter/validator/class_MoneyRefillRequestValidatorFilter.php
application/ship-simu/main/personell/class_SimulatorPersonell.php
inc/classes/interfaces/database/class_FrameworkDatabaseInterface.php
inc/classes/main/class_BaseFrameworkSystem.php
inc/classes/main/database/databases/class_LocalFileDatabase.php
inc/classes/main/resolver/action/class_BaseActionResolver.php
inc/classes/main/resolver/command/class_BaseCommandResolver.php
inc/classes/main/resolver/controller/class_BaseControllerResolver.php
inc/classes/main/resolver/controller/image/class_ImageControllerResolver.php
inc/classes/main/resolver/controller/web/class_WebControllerResolver.php
inc/classes/middleware/database/class_DatabaseConnection.php

index b0748e7..5298253 100644 (file)
@@ -99,44 +99,12 @@ class Merchant extends BaseFrameworkSystem {
 
        // Add new item to merchant's price list
        public function addItemToPriceList (TradeableItem $itemInstance, $price) {
-               // Secure pricing
-               $price = (float) $price;
-
-               // Construct pricing item and add it to the list
-               $this->priceList->append(array(
-                       'item'  => $itemInstance,
-                       'price' => $price
-               ));
-
-               // Remove price attribute
-               $itemInstance->removePrice();
+               $this->makeDeprecated();
        }
 
        // Get a price from the merchant's list
        public final function getPriceFromList (TradeableItem $itemInstance) {
-               $price = 0;
-
-               // Iterate throw whole list
-               for ($iter = $this->priceList->getIterator(); $iter->valid(); $iter->next()) {
-                       // Get current item
-                       $item = $iter->current();
-
-                       // Does this item match? The unique ID may not work...
-                       if ($item['item']->itemMatches($itemInstance)) {
-                               // Extract price and stop searching
-                               $price = $item['price'];
-                               break;
-                       }
-               }
-
-               // Was the item found?
-               if ($price === 0) {
-                       // Throw exception
-                       throw new ItemNotInPriceListException($itemInstance, self::EXCEPTION_ITEM_NOT_IN_PRICE_LIST);
-               }
-
-               // Return price
-               return $price;
+               $this->makeDeprecated();
        }
 }
 
index 632df43..1bcd932 100644 (file)
@@ -58,7 +58,18 @@ class MoneyRefillRequestValidatorFilter extends BaseFrameworkSystem implements F
         * @todo        0% done
         */
        public function execute (Requestable $requestInstance, Responseable $responseInstance) {
-               $requestInstance->debugInstance();
+               // Are all required request fields set?
+               if ((!$requestInstance->isRequestElementSet('type')) || (!$requestInstance->isRequestElementSet('amount'))) {
+                       // Something important is missing
+                       $requestInstance->requestIsValid(false);
+
+                       // Add a message to the response
+                       $responseInstance->addFatalMessage('refill_page_required_fields_missing');
+
+                       // Abort here
+                       return false;
+               } // END - if
+               die("OK!");
        }
 }
 
index 6c1e084..21fab3f 100644 (file)
@@ -118,51 +118,12 @@ class SimulatorPersonell extends BasePersonell {
         * @throws      InvalidIDFormatException        If the given id number
         *                                                                              $idNumber is invalid
         * @throws      MissingSimulatorIdException             If an ID number was not found
+        * @deprecated
         */
        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);
-               } // 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);
-
-               // Get database instance
-               $dbInstance = $personellInstance->getDatabaseInstance();
-
-               // Is the unique ID already used? Then it must be there!
-               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);
-
-               // Clean-up a little
-               $personellInstance->removeGender();
-               $personellInstance->removeNames();
-               $personellInstance->removeBirthday();
-               $personellInstance->removeSalary();
-               $personellInstance->removeEmployed();
-               $personellInstance->removeMarried();
-               $personellInstance->removeNumberFormaters();
-               //$personellInstance->removeCache();
-               $personellInstance->removeSystemArray();
-
-               // Return instance
-               return $personellInstance;
+               $personellInstance->makeDeprecated();
        }
 
        // Create personell list
@@ -359,17 +320,10 @@ class SimulatorPersonell extends BasePersonell {
         * @param       $idNumber       The ID number we shall use for looking up
         *                                              the right data.
         * @return      void
-        * @throws      ContainerItemIsNullException    If a container item is null
-        * @throws      ContainerItemIsNoArrayException If a container item is
-        *                                                                                      not an array
-        * @throws      ContainerMaybeDamagedException  If the container item
-        *                                                                                      is missing the indexes
-        *                                                                                      'name' and/or 'value'
         * @deprecated
         */
        public function loadPersonellList ($idNumber) {
-               // Cleared because old code
-               $this->partialStub("Cleared because old lost code was used.");
+               $this->makeDeprecated();
        }
 }
 
index 846f140..6e3f3d6 100644 (file)
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 interface FrameworkDatabaseInterface extends FrameworkInterface {
-       /**
-        * Analyses if a unique ID has already been used or not. This method does
-        * only pass the given ID through to the "real" database layer.
-        *
-        * @param       $uniqueID               A unique ID number which shall be checked
-        *                                                      before it will be used
-        * @param       $inConstructor  If called from a constructor or from
-        *                                                      somewhere else
-        * @return      $isUnused               true = The unique ID was not found in the database,
-        *                                                      false = It is already in use by an other object
-        */
-       function isUniqueIdUsed ($uniqueID, $inConstructor = false);
 }
 
 // [EOF]
index 9dd62b4..5652f4f 100644 (file)
@@ -558,25 +558,6 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
        }
 
        /**
-        * Compare if both simulation part description and class name matches
-        * (shall be enough)
-        *
-        * @param       $itemInstance   An object instance to an other class
-        * @return      boolean                 The result of comparing class name simulation part description
-        * @deprecated
-        */
-       public function itemMatches ($itemInstance) {
-               $this->partialStub("Deprecated!");
-               return (
-                       (
-                               $this->__toString()   == $itemInstance->__toString()
-                       ) && (
-                               $this->getObjectDescription() == $itemInstance->getObjectDescription()
-                       )
-               );
-       }
-
-       /**
         * Compare class name of this and given class name
         *
         * @param               $className      The class name as string from the other class
index 69ce662..a8cda74 100644 (file)
@@ -151,96 +151,6 @@ class LocalFileDatabase extends BaseDatabaseFrontend implements DatabaseFrontend
        }
 
        /**
-        * Analyses if a unique ID has already been used or not by search in the
-        * local database folder.
-        *
-        * @param       $uniqueID               A unique ID number which shall be checked
-        *                                                      before it will be used
-        * @param       $inConstructor  If we got called in a de/con-structor or
-        *                                                      from somewhere else
-        * @return      $isUnused               true    = The unique ID was not found in the database,
-        *                                                      false = It is already in use by an other object
-        * @throws      NoArrayCreatedException         If explode() fails to create an array
-        * @throws      InvalidArrayCountException      If the array contains less or
-        *                                                                      more than two elements
-        * @deprecated
-        */
-       public function isUniqueIdUsed ($uniqueID, $inConstructor = false) {
-               // Currently not used... ;-)
-               $isUsed = false;
-
-               // Split the unique ID up in path and file name
-               $pathFile = explode("@", $uniqueID);
-
-               // Are there two elements? Index 0 is the path, 1 the file name + global extension
-               if (!is_array($pathFile)) {
-                       // No array found
-                       if ($inConstructor) {
-                               return false;
-                       } else {
-                               throw new NoArrayCreatedException(array($this, 'pathFile'), self::EXCEPTION_ARRAY_EXPECTED);
-                       }
-               } elseif (count($pathFile) != 2) {
-                       // Invalid ID returned!
-                       if ($inConstructor) {
-                               return false;
-                       } else {
-                               throw new InvalidArrayCountException(array($this, 'pathFile', count($pathFile), 2), self::EXCEPTION_ARRAY_HAS_INVALID_COUNT);
-                       }
-               }
-
-               // Create full path name
-               $pathName = $this->getSavePath() . $pathFile[0];
-
-               // Check if the file is there with a file handler
-               if ($inConstructor) {
-                       // No exceptions in constructors and destructors!
-                       $dirInstance = FrameworkDirectoryPointer::createFrameworkDirectoryPointer($pathName, true);
-
-                       // Has an object being created?
-                       if (!is_object($dirInstance)) return false;
-               } else {
-                       // Outside a constructor
-                       try {
-                               $dirInstance = FrameworkDirectoryPointer::createFrameworkDirectoryPointer($pathName);
-                       } catch (PathIsNoDirectoryException $e) {
-                               // Okay, path not found
-                               return false;
-                       }
-               }
-
-               // Initialize the search loop
-               $isValid = false;
-               while ($dataFile = $dirInstance->readDirectoryExcept(array(".", "..", ".htaccess", ".svn", "info." . $this->getFileExtension()))) {
-                       // Generate FQFN for testing
-                       $fqfn = sprintf("%s/%s", $pathName, $dataFile);
-                       $this->setLastFile($fqfn);
-
-                       // Get instance for file handler
-                       $inputHandler = $this->getFileIoInstance();
-
-                       // Try to read from it. This makes it sure that the file is
-                       // readable and a valid database file
-                       $this->setLastFileContents($inputHandler->loadFileContents($fqfn));
-
-                       // Extract filename (= unique ID) from it
-                       $ID = substr(basename($fqfn), 0, -(strlen($this->getFileExtension()) + 1));
-
-                       // Is this the required unique ID?
-                       if ($ID == $pathFile[1]) {
-                               // Okay, already in use!
-                               $isUsed = true;
-                       }
-               }
-
-               // Close the directory handler
-               $dirInstance->closeDirectory();
-
-               // Now the same for the file...
-               return $isUsed;
-       }
-
-       /**
         * Setter for the last read file
         *
         * @param               $fqfn   The FQFN of the last read file
index 0f41a35..0c7f268 100644 (file)
@@ -101,9 +101,6 @@ class BaseActionResolver extends BaseResolver {
                        $isValid = true;
                } // END - if
 
-               // Debug output
-               //* DEBUG: */ $this->debugBackTrace();
-
                // Set action name
                $this->setActionName($actionName);
 
index f26d351..d1fa003 100644 (file)
@@ -125,9 +125,6 @@ class BaseCommandResolver extends BaseResolver {
                        $isValid = true;
                } // END - if
 
-               // Debug output
-               //* DEBUG: */ $this->debugBackTrace();
-
                // Set command name
                $this->setCommandName($commandName);
 
index 2548b4f..ec61d4e 100644 (file)
@@ -117,9 +117,6 @@ class BaseControllerResolver extends BaseResolver {
                        }
                } // END - while
 
-               // Debug output
-               //* DEBUG: */ $this->debugBackTrace();
-
                // Return the result
                return $isValid;
        }
index 157a98c..b2f4fcd 100644 (file)
@@ -120,9 +120,6 @@ class ImageControllerResolver extends BaseControllerResolver implements Controll
         *                                                                              controller class is missing (bad!)
         */
        private function loadController ($controllerName) {
-                // Debug message
-                //* DEBUG: */ $this->debugBackTrace();
-
                // Cache default command
                $defaultController = $this->getConfigInstance()->readConfig('default_image_command');
 
index 2446e6d..da09dca 100644 (file)
@@ -120,9 +120,6 @@ class WebControllerResolver extends BaseControllerResolver implements Controller
         *                                                                              controller class is missing (bad!)
         */
        private function loadController ($controllerName) {
-                // Debug message
-                //* DEBUG: */ $this->debugBackTrace();
-
                // Cache default command
                $defaultController = $this->getConfigInstance()->readConfig('default_web_command');
 
index 1d9fe9b..736ea4b 100644 (file)
@@ -99,25 +99,6 @@ class DatabaseConnection extends BaseMiddleware implements DatabaseConnector, Re
        }
 
        /**
-        * Analyses if a unique ID has already been used or not. This method does
-        * only pass the given ID through to the "real" database layer.
-        *
-        * @param       $uniqueID               A unique ID number which shall be checked
-        *                                                      before it will be used
-        * @param       $inConstructor  If called from a constructor or from
-        *                                                      somewhere else
-        * @return      $isUnused               true    = The unique ID was not found in the database,
-        *                                                      false = It is already in use by an other object
-        */
-       public function isUniqueIdUsed ($uniqueID, $inConstructor = false) {
-               // Connect to the database
-               $this->dbLayer->connectToDatabase();
-
-               // Pass the returning result through
-               return $this->dbLayer->isUniqueIdUsed($uniqueID, $inConstructor);
-       }
-
-       /**
         * Runs a "select" statement on the database layer with given table name
         * and criteria. If this doesn't fail the result will be returned
         *