]> git.mxchange.org Git - shipsimu.git/blobdiff - application/ship-simu/main/personell/class_SimulatorPersonell.php
Todo tags added to documentation
[shipsimu.git] / application / ship-simu / main / personell / class_SimulatorPersonell.php
index 1021c569e30606308eee49574cd76248211a482f..6c1e08407835b26f42d0a0f8a83356dcd2499706 100644 (file)
@@ -39,15 +39,6 @@ class SimulatorPersonell extends BasePersonell {
        protected function __construct () {
                // Call parent constructor
                parent::__construct(__CLASS__);
-
-               // Set description
-               $this->setObjectDescription("Simulationspersonal");
-
-               // Create unique ID
-               $this->generateUniqueId();
-
-               // Clean-up a little
-               $this->removeSystemArray();
        }
 
        /**
@@ -129,20 +120,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 +145,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 +167,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);
        }
 
@@ -371,6 +365,7 @@ class SimulatorPersonell extends BasePersonell {
         * @throws      ContainerMaybeDamagedException  If the container item
         *                                                                                      is missing the indexes
         *                                                                                      'name' and/or 'value'
+        * @deprecated
         */
        public function loadPersonellList ($idNumber) {
                // Cleared because old code