From a275bb05be361c57296900585d742963a5695b74 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Mon, 26 Oct 2020 09:49:10 +0100 Subject: [PATCH] Continued: - fixed some more old $packageData to $packageInstance MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- .../classes/tags/package/class_PackageTags.php | 18 +++++++++--------- .../class_XmlObjectRegistryTemplateEngine.php | 12 ++++++------ 2 files changed, 15 insertions(+), 15 deletions(-) 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] -?> +} -- 2.39.5