]> git.mxchange.org Git - hub.git/blobdiff - application/hub/main/package/class_NetworkPackage.php
Refacturing to pass a ProtocolHandler instance instead of the direct name. This
[hub.git] / application / hub / main / package / class_NetworkPackage.php
index 7d396a866993c2e7f3d9daf195ae6d0330f17d7a..0d1895047c500b738720f574d3c013ce8306b753 100644 (file)
@@ -625,10 +625,12 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R
         * stack.
         *
         * @param       $helperInstance         An instance of a Helper class
-        * @param       $protocol                       Name of used protocol (TCP/UDP)
         * @return      void
         */
-       public function enqueueRawDataFromTemplate (Helper $helperInstance, $protocolName) {
+       public function enqueueRawDataFromTemplate (Helper $helperInstance) {
+               // Get protocol instance for recipient
+               $protocolInstance = ProtocolHandlerFactory::createProtocolFromRecipientHelper($helperInstance);
+
                // Get the raw content ...
                $content = $helperInstance->getTemplateInstance()->getRawTemplateData();
                //* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('content(' . strlen($content) . ')=' . $content);
@@ -658,7 +660,7 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R
                $this->getStackInstance()->pushNamed(self::STACKER_NAME_UNDECLARED, array(
                        self::PACKAGE_DATA_SENDER    => $this->getSessionId(),
                        self::PACKAGE_DATA_RECIPIENT => $helperInstance->getRecipientType(),
-                       self::PACKAGE_DATA_PROTOCOL  => $protocolName,
+                       self::PACKAGE_DATA_PROTOCOL  => $protocolInstance->getProtocolName(),
                        self::PACKAGE_DATA_CONTENT   => $packageContent,
                        self::PACKAGE_DATA_STATUS    => self::PACKAGE_STATUS_NEW,
                        self::PACKAGE_DATA_SIGNATURE => $this->generatePackageSignature($packageContent, $this->getSessionId())