]> git.mxchange.org Git - shipsimu.git/blobdiff - inc/classes/main/class_BaseFrameworkSystem.php
More game classes added:
[shipsimu.git] / inc / classes / main / class_BaseFrameworkSystem.php
index 96338267adb4d54441d2007c7bff657c441b6610..e0716d7ade32f511558a1b5f28b25e56fd164c62 100644 (file)
@@ -73,6 +73,11 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
         */
        private $resultInstance = null;
 
+       /**
+        * Instance for user class
+        */
+       private $userInstance = null;
+
        /**
         * The real class name
         */
@@ -238,42 +243,9 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
                } elseif (is_array($args)) {
                        // Some arguments are there
                        foreach ($args as $arg) {
-                               // Check the type
-                               if (is_bool($arg)) {
-                                       // Boolean!
-                                       if ($arg) $argsString .= "true(bool)"; else $argsString .= "false(bool)";
-                               } elseif (is_int($arg)) {
-                                       // Integer
-                                       $argsString .= $arg."(int)";
-                               } elseif (is_float($arg)) {
-                                       // Floating point
-                                       $argsString .= $arg."(float)";
-                               } elseif ($arg instanceof BaseFrameworkSystem) {
-                                       // Own object instance
-                                       $argsString .= $arg->__toString()."(Object)";
-                               } elseif (is_object($arg)) {
-                                       // External object
-                                       $argsString .= "unknown object(!)";
-                               } elseif (is_array($arg)) {
-                                       // Array
-                                       $argsString .= "Array(array)";
-                               } elseif (is_string($arg)) {
-                                       // String
-                                       $argsString .= "\"".$arg."\"(string)";
-                               } elseif (is_null($arg)) {
-                                       // Null
-                                       $argsString .= "(null)";
-                               } elseif (is_resource($arg)) {
-                                       // Resource
-                                       $argsString .= "(resource)";
-                               } else {
-                                       // Unknown type (please report!)
-                                       $argsString .= $arg."(<em>unknown!</em>)";
-                               }
-
-                               // Add comma
-                               $argsString .= ", ";
-                       }
+                               // Add the type
+                               $argsString .= $arg." (".gettype($arg)."), ";
+                       } // END - foreach
 
                        // Remove last comma
                        if (substr($argsString, -2, 1) === ",") {
@@ -1235,38 +1207,22 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
        }
 
        /**
-        * Updates a given field with new value
+        * Protected setter for user instance
         *
-        * @param       $fieldName              Field to update
-        * @param       $fieldValue             New value to store
+        * @param       $userInstance   An instance of a user class
         * @return      void
-        * @throws      DatabaseUpdateSupportException  If this class does not support database updates
         */
-       public function updateDatabaseField ($fieldName, $fieldValue) {
-               // Is updating database fields allowed by interface?
-               if (!$this instanceof Updateable) {
-                       // Update not supported!
-                       throw new DatabaseUpdateSupportException($this, self::EXCEPTION_DATABASE_UPDATED_NOT_ALLOWED);
-               } // END - if
-
-               // Get a critieria instance
-               $searchInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class');
-
-               // Add search criteria
-               $searchInstance->addCriteria(UserDatabaseWrapper::DB_COLUMN_USERNAME, $this->getUserName());
-               $searchInstance->setLimit(1);
-
-               // Now get another criteria
-               $updateInstance = ObjectFactory::createObjectByConfiguredName('update_criteria_class');
-
-               // And add our both entries
-               $updateInstance->addCriteria($fieldName, $fieldValue);
-
-               // Add the search criteria for searching for the right entry
-               $updateInstance->setSearchInstance($searchInstance);
+       protected final function setUserInstance (ManageableAccount $userInstance) {
+               $this->userInstance = $userInstance;
+       }
 
-               // Remember the update in database result
-               $this->getResultInstance()->add2UpdateQueue($updateInstance);
+       /**
+        * Getter for user instance
+        *
+        * @return      $userInstance   An instance of a user class
+        */
+       public final function getUserInstance () {
+               return $this->userInstance;
        }
 }