class_PassengerShip.php
Go to the documentation of this file.00001 <?php
00025 class PassengerShip extends BaseShip implements ConstructableShip {
00026
00027 protected function __construct () {
00028
00029 parent::__construct(__CLASS__);
00030
00031
00032 $this->removeSystemArray();
00033 $this->removeNumberFormaters();
00034 }
00035
00036
00037 public final static function createPassengerShip ($shipName) {
00038
00039 $passInstance = new PassengerShip();
00040
00041
00042 $passInstance->setShipName($shipName);
00043
00044
00045 return $passInstance;
00046 }
00047
00048
00049 public final function calcTotalBeds () {
00050
00051 $struct = $this->getStructuresArray();
00052
00053 if (is_null($struct)) {
00054
00055 throw new EmptyStructuresListException($this, self::EXCEPTION_EMPTY_STRUCTURES_ARRAY);
00056 }
00057
00058
00059 $numBeds = 0;
00060
00061
00062 for ($idx = $struct->getIterator(); $idx->valid(); $idx->next()) {
00063
00064 $el = $idx->current();
00065
00066
00067 if ($el->isCabin()) {
00068
00069 $total = $el->calcTotalBedsByCabin();
00070 $numBeds += $total;
00071
00072
00073 if ((defined('DEBUG_SHIP')) || (defined('DEBUG_ALL'))) {
00074
00075 $cabType = "Kabine ohne Namen";
00076 $cab = $el->getPartInstance();
00077 if (!is_null($cab)) {
00078
00079 $cabType = $cab->getObjectDescription();
00080 }
00081 }
00082 }
00083 }
00084
00085
00086 return $numBeds;
00087 }
00088 }
00089
00090
00091 ?>