]> git.mxchange.org Git - hub.git/blobdiff - application/hub/main/helper/hub/connection/class_HubSelfConnectHelper.php
Refactured nodeInstance to be no longer stored in helpers
[hub.git] / application / hub / main / helper / hub / connection / class_HubSelfConnectHelper.php
index 8d9131db88a937b5d5df0febabb132548ac6a0f0..26761f19f093ee13b9e97b858be08e9e9163d73a 100644 (file)
@@ -44,16 +44,12 @@ class HubSelfConnectHelper extends BaseHubHelper implements HelpableHub {
        /**
         * Creates the helper class
         *
-        * @param       $nodeInstance           An instance of a NodeHelper class
         * @return      $helperInstance         A prepared instance of this helper
         */
-       public static final function createHubSelfConnectHelper (NodeHelper $nodeInstance) {
+       public static final function createHubSelfConnectHelper () {
                // Get new instance
                $helperInstance = new HubSelfConnectHelper();
 
-               // Set the node instance
-               $helperInstance->setNodeInstance($nodeInstance);
-
                // Return the prepared instance
                return $helperInstance;
        }
@@ -83,11 +79,12 @@ class HubSelfConnectHelper extends BaseHubHelper implements HelpableHub {
        /**
         * Do the self-connect attempt by delivering a package to ourselfs
         *
+        * @param       $nodeInstance   An instance of a NodeHelper class
         * @return      void
         */
-       public function sendPackage () {
+       public function sendPackage (NodeHelper $nodeInstance) {
                // Sanity check: Is the node in the approx. state? (active)
-               $this->getNodeInstance()->getStateInstance()->validateNodeStateIsActive();
+               $nodeInstance->getStateInstance()->validateNodeStateIsActive();
 
                // Compile the template, this inserts the loaded node data into the gaps.
                $this->getTemplateInstance()->compileTemplate();
@@ -96,7 +93,7 @@ class HubSelfConnectHelper extends BaseHubHelper implements HelpableHub {
                $packageInstance = NetworkPackageFactory::createNetworkPackageInstance();
 
                // Next, feed the content in. The network package class is a pipe-through class.
-               $packageInstance->enqueueRawDataFromTemplate($this);
+               $packageInstance->enqueueRawDataFromTemplate($this, $nodeInstance);
        }
 
        /**