]> git.mxchange.org Git - hub.git/blobdiff - application/hub/main/tags/package/class_PackageTags.php
A lot changes for refacturing protocol handler
[hub.git] / application / hub / main / tags / package / class_PackageTags.php
index 71934123dcc316a8aab5f0b2bbd6f680c86e05e3..242511c8fd01b86e937795f852e0e2fdadeac9f3 100644 (file)
@@ -97,6 +97,9 @@ class PackageTags extends BaseTags implements Tagable {
         * @return      void
         */
        private function extractTagsFromPackageData (array $packageData) {
+               // Debug message
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('TAGS[' . __METHOD__ . ':' . __LINE__ . ']: packageData=' . print_r($packageData, TRUE));
+
                /*
                 * We take a look at the tags (in most cases only one is needed) so
                 * first we need the content data splitted up into all it's parts.
@@ -113,10 +116,11 @@ class PackageTags extends BaseTags implements Tagable {
         * shared over the whole hub-network. So if the "tag" (let's better say
         * object type) isn't found in that XML the package won't be distributed.
         *
+        * @param       $packageData                    Raw package data
         * @return      void
         * @throws      InvalidTagException             If a provided tag from the package data is invalid
         */
-       private function verifyAllTags () {
+       private function verifyAllTags (array $packageData) {
                // Get the registry
                $objectRegistryInstance = ObjectTypeRegistryFactory::createObjectTypeRegistryInstance();
 
@@ -135,7 +139,7 @@ class PackageTags extends BaseTags implements Tagable {
                        } // END - if
 
                        // Now save the last discovered protocol/recipient type
-                       $this->lastProtocol      = ProtocolHandlerFactory::createProtocolHandlerFromArray($entry);
+                       $this->lastProtocol      = ProtocolHandlerFactory::createProtocolHandlerFromPackageData($packageData);
                        $this->lastRecipientType = $entry[XmlObjectRegistryTemplateEngine::OBJECT_TYPE_DATA_RECIPIENT_TYPE];
                } // END - foreach
        }
@@ -144,14 +148,14 @@ class PackageTags extends BaseTags implements Tagable {
         * Chooses the right protocol from given package data
         *
         * @param       $packageData    Raw package data
-        * @return      $lastProtocol   An instance of the last used ProtocolHandler class
+        * @return      $lastProtocol   An instance of the last used HandleableProtocol class
         */
        public function chooseProtocolFromPackageData (array $packageData) {
                // Extract the tags
                $this->extractTagsFromPackageData($packageData);
 
                // Now we need to verify every single tag
-               $this->verifyAllTags();
+               $this->verifyAllTags($packageData);
 
                // Return the last (and only) found protocol (e.g. 'tcp' is very usual)
                return $this->lastProtocol;
@@ -169,7 +173,7 @@ class PackageTags extends BaseTags implements Tagable {
                $this->extractTagsFromPackageData($packageData);
 
                // Now we need to verify every single tag
-               $this->verifyAllTags();
+               $this->verifyAllTags($packageData);
 
                // Now simply check it out
                $accepts = (($this->lastRecipientType == $listenerInstance->getListenerType()) && ($listenerInstance->getListenerType() != 'invalid'));