// 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();
}
}
* @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!");
}
}
* @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
* @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();
}
}
* 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]
$this->realClass = $realClass;
}
- /**
- * 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
*
return $this->lastException;
}
- /**
- * 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
*
$isValid = true;
} // END - if
- // Debug output
- //* DEBUG: */ $this->debugBackTrace();
-
// Set action name
$this->setActionName($actionName);
$isValid = true;
} // END - if
- // Debug output
- //* DEBUG: */ $this->debugBackTrace();
-
// Set command name
$this->setCommandName($commandName);
}
} // END - while
- // Debug output
- //* DEBUG: */ $this->debugBackTrace();
-
// Return the result
return $isValid;
}
* controller class is missing (bad!)
*/
private function loadController ($controllerName) {
- // Debug message
- //* DEBUG: */ $this->debugBackTrace();
-
// Cache default command
$defaultController = $this->getConfigInstance()->readConfig('default_image_command');
* controller class is missing (bad!)
*/
private function loadController ($controllerName) {
- // Debug message
- //* DEBUG: */ $this->debugBackTrace();
-
// Cache default command
$defaultController = $this->getConfigInstance()->readConfig('default_web_command');
$this->dbLayer = $dbLayer;
}
- /**
- * 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