]> git.mxchange.org Git - hub.git/blobdiff - application/hub/main/nodes/class_BaseHubNode.php
Updating node data in local DHT (not yet distributed here, that will do an other...
[hub.git] / application / hub / main / nodes / class_BaseHubNode.php
index 027091571d8abc8d12dc1a0f183067eb84a14d73..a30164e9c5fab16716da71bbcb454e64918ef53b 100644 (file)
@@ -779,6 +779,27 @@ class BaseHubNode extends BaseHubSystem implements Updateable, AddableCriteria {
                // ... and return it
                return $objectList;
        }
+
+       /**
+        * Adds all required elements from given array into data set instance
+        *
+        * @param       $dataSetInstance        An instance of a StoreableCriteria class
+        * @param       $nodeData                       An array with valid node data
+        * @return      void
+        */
+       public function addArrayToDataSet (StoreableCriteria $dataSetInstance, array $nodeData) {
+               // Add all data the array provides
+               foreach (NodeDistributedHashTableDatabaseWrapper::getAllElements() as $element) {
+                       // Is the element there?
+                       if (isset($nodeData[$element])) {
+                               // Add it
+                               $dataSetInstance->addCriteria($element, $nodeData[$element]);
+                       } else {
+                               // Output warning message
+                               /* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('NODE[' . __LINE__ . ']: addArrayToDataSet(): Element ' . $element . ' not found in nodeData array.');
+                       }
+               } // END - foreac
+       }
 }
 
 // [EOF]