From: Roland Häder Date: Mon, 26 Oct 2020 08:49:10 +0000 (+0100) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=a275bb05be361c57296900585d742963a5695b74;p=hub.git Continued: - fixed some more old $packageData to $packageInstance Signed-off-by: Roland Häder --- diff --git a/application/hub/classes/tags/package/class_PackageTags.php b/application/hub/classes/tags/package/class_PackageTags.php index d25d7ad8b..bcf0c093a 100644 --- a/application/hub/classes/tags/package/class_PackageTags.php +++ b/application/hub/classes/tags/package/class_PackageTags.php @@ -133,7 +133,7 @@ class PackageTags extends BaseTag 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 An instance of a DeliverablePackage class + * @param $packageInstance An instance of a DeliverablePackage class * @return void * @throws InvalidTagException If a provided tag from the package data is invalid */ @@ -144,7 +144,7 @@ class PackageTags extends BaseTag implements Tagable { // "Walk" over all tags foreach ($this->getTags() as $tag) { // Debug output - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TAGS: Validating tag ' . $tag . ' ...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('TAGS: Validating tag %s ...', $tag)); // Get an array from this tag $entry = $objectRegistryInstance->getArrayFromKey(XmlObjectRegistryTemplateEngine::OBJECT_TYPE_DATA_NAME, $tag); @@ -159,7 +159,7 @@ class PackageTags extends BaseTag implements Tagable { } // END - if // Now save the last discovered protocol/recipient type - $this->lastProtocol = ProtocolHandlerFactory::createProtocolHandlerFromPackageInstance($packageData); + $this->lastProtocol = ProtocolHandlerFactory::createProtocolHandlerFromPackageInstance($packageInstance); $this->lastRecipientType = $entry[XmlObjectRegistryTemplateEngine::OBJECT_TYPE_DATA_RECIPIENT_TYPE]; } // END - foreach } @@ -167,15 +167,15 @@ class PackageTags extends BaseTag implements Tagable { /** * Chooses the right protocol from given package data * - * @param $packageData An instance of a DeliverablePackage class + * @param $packageInstance An instance of a DeliverablePackage class * @return $lastProtocol An instance of the last used HandleableProtocol class */ public function chooseProtocolFromPackageInstance (DeliverablePackage $packageInstance) { // Extract the tags - $this->extractTagsFromPackageInstance($packageData); + $this->extractTagsFromPackageInstance($packageInstance); // Now we need to verify every single tag - $this->verifyAllTags($packageData); + $this->verifyAllTags($packageInstance); // Return the last (and only) found protocol (e.g. 'tcp' is very usual) return $this->lastProtocol; @@ -184,16 +184,16 @@ class PackageTags extends BaseTag implements Tagable { /** * Checks whether the given package data is accepted by the listener * - * @param $packageData An instance of a DeliverablePackage class + * @param $packageInstance An instance of a DeliverablePackage class * @param $listenerInstance A Listenable instance * @return $accepts Whether it is accepted */ public function ifPackageDataIsAcceptedByListener (DeliverablePackage $packageInstance, Listenable $listenerInstance) { // Extract the tags - $this->extractTagsFromPackageInstance($packageData); + $this->extractTagsFromPackageInstance($packageInstance); // Now every single tag needs to be validated - $this->verifyAllTags($packageData); + $this->verifyAllTags($packageInstance); // Now simply check it out $accepts = (($this->lastRecipientType == $listenerInstance->getListenerType()) && ($listenerInstance->getListenerType() != 'invalid')); diff --git a/application/hub/classes/template/objects/class_XmlObjectRegistryTemplateEngine.php b/application/hub/classes/template/objects/class_XmlObjectRegistryTemplateEngine.php index 84032e1bc..b389c1166 100644 --- a/application/hub/classes/template/objects/class_XmlObjectRegistryTemplateEngine.php +++ b/application/hub/classes/template/objects/class_XmlObjectRegistryTemplateEngine.php @@ -99,10 +99,10 @@ class XmlObjectRegistryTemplateEngine extends BaseXmlTemplateEngine implements C * @param $resource XML parser resource (currently ignored) * @param $characters Characters to handle * @return void - * @todo Find something useful with this! */ public function characterHandler ($resource, $characters) { // Trim all spaces away + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('TAGS: resource[%s]=%s,characters[%s]=%s - CALLED!', gettype($resource), $resource, gettype($characters), $characters)); $characters = trim($characters); // Is this string empty? @@ -115,13 +115,15 @@ class XmlObjectRegistryTemplateEngine extends BaseXmlTemplateEngine implements C $nodeName = $this->getStackInstance()->getNamed('node_object_registry'); // Is the node name self::OBJECT_TYPE_DATA_NAME? + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('TAGS: Checking nodeName=%s ...', $nodeName)); if ($nodeName == self::OBJECT_TYPE_DATA_NAME) { // Output debug message - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TAGS: Adding object type ' . $characters . ' to registry.'); + //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TAGS: Adding object type ' . $characters . ' to registry.'); + $this->objectRegistryInstance->addEntry($nodeName, $characters); } // END - if // Add it to the registry - $this->objectRegistryInstance->addEntry($nodeName, $characters); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TAGS: EXIT!'); } /** @@ -294,7 +296,5 @@ class XmlObjectRegistryTemplateEngine extends BaseXmlTemplateEngine implements C // Pop the last entry $this->getStackInstance()->popNamed('node_object_registry'); } -} -// [EOF] -?> +}