From dd9dd91b29f1961edfbb698e9e655e6af5deaec8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Fri, 21 Aug 2020 20:32:08 +0200 Subject: [PATCH] Continued: - fixed name for factory and also "imported" it - added missing properties $contentHash and $packageContent with setters and getters MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- .../package/class_NetworkPackageHandler.php | 3 +- .../classes/listener/class_BaseListener.php | 2 +- .../package/deliverable/class_PackageData.php | 52 ++++++++++++++++++- 3 files changed, 53 insertions(+), 4 deletions(-) diff --git a/application/hub/classes/handler/package/class_NetworkPackageHandler.php b/application/hub/classes/handler/package/class_NetworkPackageHandler.php index 92259970b..32a52e256 100644 --- a/application/hub/classes/handler/package/class_NetworkPackageHandler.php +++ b/application/hub/classes/handler/package/class_NetworkPackageHandler.php @@ -12,6 +12,7 @@ use Org\Shipsimu\Hub\Factory\Discovery\Socket\SocketDiscoveryFactory; use Org\Shipsimu\Hub\Factory\FilterChain\Package\PackageFilterChainFactory; use Org\Shipsimu\Hub\Factory\Handler\Message\MessageTypeHandlerFactory; use Org\Shipsimu\Hub\Factory\Information\Connection\ConnectionInfoFactory; +use Org\Shipsimu\Hub\Factory\Network\PackageDataFactory; use Org\Shipsimu\Hub\Factory\Node\NodeObjectFactory; use Org\Shipsimu\Hub\Handler\BaseHubHandler; use Org\Shipsimu\Hub\Handler\Network\RawData\HandleableRawData; @@ -831,7 +832,7 @@ class NetworkPackageHandler extends BaseHubHandler implements Deliverable, Recei assert($this->getSessionId() != ''); // Init package instance - $packageInstance = PackageDataFactory::createDeliverPackageInstance(); + $packageInstance = PackageDataFactory::createPackageDataInstance(); // Set all data $packageInstance->setSenderAddress($this->getSessionId()); diff --git a/application/hub/classes/listener/class_BaseListener.php b/application/hub/classes/listener/class_BaseListener.php index 82380b976..da6171ce0 100644 --- a/application/hub/classes/listener/class_BaseListener.php +++ b/application/hub/classes/listener/class_BaseListener.php @@ -403,7 +403,7 @@ abstract class BaseListener extends BaseHubSystem implements Visitable { //* DEBUG-DIE: */ $infoInstance->debugInstance(); // Create a faked package data instance - $packageInstance = DeliverPackageFactory::createDeliverPackageInstance(); + $packageInstance = PackageDataFactory::createPackageDataInstance(); // Set all required data $packageInstance->setSenderAddres($peerAddress . $peerSuffix); diff --git a/application/hub/classes/package/deliverable/class_PackageData.php b/application/hub/classes/package/deliverable/class_PackageData.php index dc938bc61..a76158e4e 100644 --- a/application/hub/classes/package/deliverable/class_PackageData.php +++ b/application/hub/classes/package/deliverable/class_PackageData.php @@ -35,6 +35,16 @@ use \SplFileInfo; */ class PackageData extends BaseHubSystem implements DeliverablePackage, Registerable { + /** + * Content hash + */ + private $contentHash; + + /** + * Package content + */ + private $packageContent; + /** * An instance of a SplFileInfo class */ @@ -90,7 +100,7 @@ class PackageData extends BaseHubSystem implements DeliverablePackage, Registera /** * Getter for socket type * - * @return $socketFile Stocket type + * @return $socketType Stocket type */ public function getSocketType () { return $this->socketType; @@ -99,11 +109,49 @@ class PackageData extends BaseHubSystem implements DeliverablePackage, Registera /** * Setter for socket type * - * @param $socketType Socket type + * @param $socketType Socket type * @return void */ public function setSocketType ($socketType) { $this->socketType = $socketType; } + /** + * Getter for package content + * + * @return $packageContent Package content + */ + public function getPackageContent () { + return $this->packageContent; + } + + /** + * Setter for package content + * + * @param $packageContent Package content + * @return void + */ + public function setPackageContent ($packageContent) { + $this->packageContent = $packageContent; + } + + /** + * Getter for content hash + * + * @return $contentHash Content hash + */ + public function getContentHash () { + return $this->contentHash; + } + + /** + * Setter for content hash + * + * @param $contentHash Content hash + * @return void + */ + public function setContentHash ($contentHash) { + $this->contentHash = $contentHash; + } + } -- 2.39.5