]> git.mxchange.org Git - hub.git/blobdiff - application/hub/main/package/class_NetworkPackage.php
Refactured nodeInstance to be no longer stored in helpers
[hub.git] / application / hub / main / package / class_NetworkPackage.php
index c8479677ab683618c752d0fd7218a87219e81a1d..c7e37ab8c4c6a49b573f033dcf05d4360cd17b8d 100644 (file)
@@ -142,16 +142,17 @@ class NetworkPackage extends BaseFrameworkSystem implements Deliverable, Registe
         * "Getter" for hash from given content and helper instance
         *
         * @param       $content        Raw package content
-        * @param       $helperInstance         A BaseHubHelper instance
+        * @param       $helperInstance         An instance of a BaseHubHelper class
+        * @param       $nodeInstance           An instance of a NodeHelper class
         * @return      $hash   Hash for given package content
         */
-       private function getHashFromContent ($content, BaseHubHelper $helperInstance) {
+       private function getHashFromContent ($content, BaseHubHelper $helperInstance, NodeHelper $nodeInstance) {
                // Create the hash
                // @TODO crc32 is not good, but it needs to be fast
                $hash = crc32(
                        $content .
                        ':' .
-                       $helperInstance->getNodeInstance()->getSessionId() .
+                       $nodeInstance->getSessionId() .
                        ':' .
                        $this->getCompressorInstance()->getCompressorExtension()
                );
@@ -271,10 +272,11 @@ class NetworkPackage extends BaseFrameworkSystem implements Deliverable, Registe
         * "Enqueues" raw content into this delivery class by reading the raw content
         * from given template instance and pushing it on the 'undeclared' stack.
         *
-        * @param       $helperInstance         A BaseHubHelper instance
+        * @param       $helperInstance         An instance of a  BaseHubHelper class
+        * @param       $nodeInstance           An instance of a NodeHelper class
         * @return      void
         */
-       public function enqueueRawDataFromTemplate (BaseHubHelper $helperInstance) {
+       public function enqueueRawDataFromTemplate (BaseHubHelper $helperInstance, NodeHelper $nodeInstance) {
                // Get the raw content ...
                $content = $helperInstance->getTemplateInstance()->getRawTemplateData();
 
@@ -290,12 +292,12 @@ class NetworkPackage extends BaseFrameworkSystem implements Deliverable, Registe
                        // 3.) Tags
                        implode(self::PACKAGE_TAGS_SEPERATOR, $helperInstance->getPackageTags()),
                        // 4.) Checksum
-                       $this->getHashFromContent($content, $helperInstance)
+                       $this->getHashFromContent($content, $helperInstance, $nodeInstance)
                );
 
                // Now prepare the temporary array and push it on the 'undeclared' stack
                $this->getStackerInstance()->pushNamed(self::STACKER_NAME_UNDECLARED, array(
-                       'sender'    => $helperInstance->getNodeInstance()->getSessionId(),
+                       'sender'    => $nodeInstance->getSessionId(),
                        'recipient' => $helperInstance->getRecipientType(),
                        'content'   => $content,
                ));