00001 <?php 00024 class Merchant extends BaseFrameworkSystem { 00025 // Name des Haendlers 00026 private $merchantName = "Namenloser Händler"; 00027 00028 // Preislite (Objekte wiedermal!) 00029 private $priceList = null; 00030 00031 // Zugewiesener Hafen 00032 private $harborInstance = null; 00033 00034 // Konstruktor 00035 protected function __construct () { 00036 // Call parent constructor 00037 parent::__construct(__CLASS__); 00038 00039 // Clean up a little 00040 $this->removeSystemArray(); 00041 } 00042 00043 // Haendler mit Namen erzeugen 00044 public final static function createMerchant ($merchantName, Harbor $harborInstance) { 00045 // String absichern 00046 $merchantName = (string) $merchantName; 00047 00048 // Get new instance 00049 $merchantInstance = new Merchant(); 00050 00051 // Debug message 00052 if ((defined('DEBUG_MERCHANT')) || (defined('DEBUG_ALL'))) { 00053 $merchantInstance->debugOutput(sprintf("[%s:%d] Ein Händler <strong>%s</strong> wird angelegt und soll sich am <strong>%s</strong> niederlassen.", 00054 __CLASS__, 00055 __LINE__, 00056 $merchantName, 00057 $harborInstance->getHarborName() 00058 )); 00059 } 00060 00061 // Haendlernamen setzen 00062 $merchantInstance->setMerchantName($merchantName); 00063 00064 // In dem angegebenen Hafen den Haendler ansiedeln 00065 $merchantInstance->setHarborInstance($harborInstance); 00066 00067 // Preisliste initialisieren 00068 $merchantInstance->createPriceList(); 00069 00070 // Instanz zurueckliefern 00071 return $merchantInstance; 00072 } 00073 00074 // Initialize pricing list 00075 private function createPriceList () { 00076 $this->priceList = new FrameworkArrayObject("FakedPriceList"); 00077 } 00078 00079 // Setter for merchant name 00080 public final function setMerchantName ($merchantName) { 00081 // Debug message 00082 $this->merchantName = (string) $merchantName; 00083 } 00084 00085 // Getter for merchant name 00086 public final function getMerchantName () { 00087 return $this->merchantName; 00088 } 00089 00090 // Setter for harbor instance 00091 public final function setHarborInstance (Harbor $harborInstance) { 00092 $this->harborInstance = $harborInstance; 00093 } 00094 00095 // Getter for harbor instance 00096 public final function getHarborInstance () { 00097 return $this->harborInstance; 00098 } 00099 00100 // Add new item to merchant's price list 00101 public function addItemToPriceList (TradeableItem $itemInstance, $price) { 00102 $this->makeDeprecated(); 00103 } 00104 00105 // Get a price from the merchant's list 00106 public final function getPriceFromList (TradeableItem $itemInstance) { 00107 $this->makeDeprecated(); 00108 } 00109 } 00110 00111 // [EOF] 00112 ?>
1.5.6