]> git.mxchange.org Git - hub.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Sat, 1 Feb 2025 22:40:59 +0000 (23:40 +0100)
committerRoland Häder <roland@mxchange.org>
Sat, 1 Feb 2025 23:32:58 +0000 (00:32 +0100)
- added more returned scalar types
- updated 'core' framework

application/hub/classes/dht/class_
application/hub/classes/dht/class_BaseDht.php
application/hub/classes/dht/node/class_NodeDhtFacade.php
application/hub/classes/feature/hubcoin_reward/class_HubcoinRewardFeature.php
application/hub/classes/pools/peer/class_DefaultPeerPool.php
application/hub/classes/tools/hub/class_HubTools.php
application/hub/classes/tools/node/class_NodeLocatorUtils.php
application/hub/interfaces/distributable/node/class_DistributableNode.php
application/hub/interfaces/pool/peer/class_PoolablePeer.php
core

index cbb5a5f19ec21f118d6f45dacfa896deae0bb312..bf011e8167641cf804216cd5c9c37d5ca8de29a3 100644 (file)
@@ -47,7 +47,7 @@ class ???DhtFacade extends BaseDht implements Distributable {
         *
         * @return      $dhtInstance    An instance of a Distributable class
         */
-       public final static function create??? () {
+       public final static function create??? (): Distributable {
                // Get new instance
                $dhtInstance = new ???DhtFacade();
 
@@ -64,7 +64,8 @@ class ???DhtFacade extends BaseDht implements Distributable {
         * @return      void
         * @todo        0% done
         */
-       protected function insertDataIntoDht (array $dhtData) {
+       protected function insertDataIntoDht (array $dhtData): void {
                DebugMiddleware::getSelfInstance()->partialStub('Please implement this method.');
        }
+
 }
index 2ea555305ced02305801ac2d83e6e0666b7a5c87..16bd47190411d18a60bd134ba6271aa0a00a2a23 100644 (file)
@@ -87,7 +87,7 @@ abstract class BaseDht extends BaseHubSystem implements Distributable {
         *
         * @return      void
         */
-       private function initStacks () {
+       private function initStacks (): void {
                // Initialize all stacker
                $this->getStackInstance()->initStacks([
                        self::STACKER_NAME_INSERT_NODE,
@@ -103,7 +103,7 @@ abstract class BaseDht extends BaseHubSystem implements Distributable {
         * @param       $dhtData        A valid array with DHT-related data (e.g. node/peer data)
         * @return      void
         */
-       protected abstract function insertDataIntoDht (array $dhtData);
+       protected abstract function insertDataIntoDht (array $dhtData): void;
 
        /**
         * Updates/refreshes DHT data (e.g. status).
@@ -111,7 +111,7 @@ abstract class BaseDht extends BaseHubSystem implements Distributable {
         * @return      void
         * @todo        Find more to do here
         */
-       public function updateDhtData () {
+       public function updateDhtData (): void {
                // Set some dummy configuration entries, e.g. dht_status
                FrameworkBootstrap::getConfigurationInstance()->setConfigEntry('dht_status', $this->getStateInstance()->getStateName());
        }
@@ -121,7 +121,7 @@ abstract class BaseDht extends BaseHubSystem implements Distributable {
         *
         * @return      $isPending      Whether there are pending entries
         */
-       public function ifInsertNodeDataPending () {
+       public function ifInsertNodeDataPending (): bool {
                // Determine it if it is not empty
                $isPending = ($this->getStackInstance()->isStackEmpty(self::STACKER_NAME_INSERT_NODE) === FALSE);
 
@@ -134,7 +134,7 @@ abstract class BaseDht extends BaseHubSystem implements Distributable {
         *
         * @return      void
         */
-       public function insertSingleNodeData () {
+       public function insertSingleNodeData (): void {
                // Get next node data from stack
                $nodeData = $this->getStackInstance()->popNamed(self::STACKER_NAME_INSERT_NODE);
 
@@ -151,7 +151,7 @@ abstract class BaseDht extends BaseHubSystem implements Distributable {
         * @return      $hasUnpublished         Whether there are unpublished entries
         * @todo        Add minimum/maximum age limitations
         */
-       public function hasUnpublishedEntries () {
+       public function hasUnpublishedEntries (): bool {
                // Call method on database frontend
                $hasUnpublished = $this->getFrontendInstance()->hasUnpublishedEntries();
 
@@ -167,7 +167,7 @@ abstract class BaseDht extends BaseHubSystem implements Distributable {
         * @return      void
         * @throws      UnexpectedValueException        If $resultInstance is not valid
         */
-       public function initEntryPublication () {
+       public function initEntryPublication (): void {
                // Call method on database frontend
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-DHT: CALLED!');
                $this->getFrontendInstance()->initEntryPublication();
@@ -210,7 +210,7 @@ abstract class BaseDht extends BaseHubSystem implements Distributable {
         *
         * @return      $isPending      Whether there are entries pending publication
         */
-       public function hasEntriesPendingPublication () {
+       public function hasEntriesPendingPublication (): bool {
                // Determine it if it is not empty
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-DHT: CALLED!');
                $isPending = ($this->getStackInstance()->isStackEmpty(self::STACKER_NAME_PENDING_PUBLISHING) === FALSE);
@@ -225,7 +225,7 @@ abstract class BaseDht extends BaseHubSystem implements Distributable {
         *
         * @return      $isBooting      Whether this DHT is currently booting
         */
-       public function ifDhtIsBooting () {
+       public function ifDhtIsBooting (): boot {
                // Call state instance
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-DHT: CALLED!');
                $isBooting = $this->getStateInstance()->ifDhtIsBooting();
@@ -243,7 +243,7 @@ abstract class BaseDht extends BaseHubSystem implements Distributable {
         * @todo        Find out if loadDescriptorXml() can be called only once to avoid a lot methods working.
         * @throws      BadMethodCallException  If this method was called but no pending entries publication
         */
-       public function publishEntry () {
+       public function publishEntry (): void {
                // This test must not fail
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-DHT: CALLED!');
                if (!$this->hasEntriesPendingPublication()) {
@@ -288,7 +288,7 @@ abstract class BaseDht extends BaseHubSystem implements Distributable {
         * @return      $isFullyBooted  Whether the DHT is fully booted
         * @todo        0% done
         */
-       public function hasFullyBootstrapped () {
+       public function hasFullyBootstrapped (): bool {
                // Get state and check it
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-DHT: CALLED!');
                DebugMiddleware::getSelfInstance()->partialStub('Please implement this method.');
@@ -300,7 +300,7 @@ abstract class BaseDht extends BaseHubSystem implements Distributable {
         * @return      void
         * @todo        Switch flag 'accept_bootstrap'
         */
-       public function enableAcceptDhtBootstrap () {
+       public function enableAcceptDhtBootstrap (): void {
                // Call method on database frontend
                $this->getFrontendInstance()->enableAcceptDhtBootstrap();
        }
index 54296add0e53ba05b398dfe76d241640290beec9..96067f75a2f92bcfbad57817ff5d5ca7161574aa 100644 (file)
@@ -66,7 +66,7 @@ class NodeDhtFacade extends BaseDht implements DistributableNode, Registerable {
         *
         * @return      $dhtInstance    An instance of a Distributable class
         */
-       public final static function createNodeDhtFacade () {
+       public final static function createNodeDhtFacade (): DistributableNode {
                // Get new instance
                $dhtInstance = new NodeDhtFacade();
 
@@ -89,7 +89,7 @@ class NodeDhtFacade extends BaseDht implements DistributableNode, Registerable {
         * @return      void
         * @todo        Does this data need to be enriched with more meta data?
         */
-       protected function insertDataIntoDht (array $dhtData) {
+       protected function insertDataIntoDht (array $dhtData): void {
                // Check if there is already an entry for given node_id
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NODE-DHT-FACADE: dhtData()=%d - CALLED!', count($dhtData)));
                if ($this->getFrontendInstance()->isNodeRegistered($dhtData)) {
@@ -118,7 +118,7 @@ class NodeDhtFacade extends BaseDht implements DistributableNode, Registerable {
         *
         * @return      void
         */
-       public function initDht () {
+       public function initDht (): void {
                // Is the local node registered?
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE-DHT-FACADE: CALLED!');
                if ($this->getFrontendInstance()->isLocalNodeRegistered()) {
@@ -145,7 +145,7 @@ class NodeDhtFacade extends BaseDht implements DistributableNode, Registerable {
         *
         * @return      void
         */
-       public function bootstrapDht () {
+       public function bootstrapDht (): void {
                // Get a helper instance
                $helperInstance = ObjectFactory::createObjectByConfiguredName('dht_bootstrap_helper_class');
 
@@ -172,7 +172,7 @@ class NodeDhtFacade extends BaseDht implements DistributableNode, Registerable {
         * @param       $sessionId      Session id to lookup
         * @return      $nodeData       Node-data array
         */
-       public function findNodeLocalBySessionId (string $sessionId) {
+       public function findNodeLocalBySessionId (string $sessionId): array {
                // Validate parameter
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NODE-DHT-FACADE: sessionId=%s - CALLED!', $sessionId));
                if (empty($sessionId)) {
@@ -213,7 +213,7 @@ class NodeDhtFacade extends BaseDht implements DistributableNode, Registerable {
         * @param       $locatorInstance        An instance of a LocateableNode class
         * @return      $nodeData       Node-data array
         */
-       public function findNodeByUniversalNodeLocator (LocateableNode $locatorInstance) {
+       public function findNodeByUniversalNodeLocator (LocateableNode $locatorInstance): array {
                // Default is empty data array
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NODE-DHT-FACADE: locatorInstance=%s - CALLED!', $locatorInstance->__toString()));
                //* DEBUG-DIE: */ ApplicationEntryPoint::exitApplication(sprintf('[%s:%d]: locatorInstance=%s', __METHOD__, __LINE__, print_r($locatorInstance, TRUE)));
@@ -256,7 +256,7 @@ class NodeDhtFacade extends BaseDht implements DistributableNode, Registerable {
         * @throws      NodeSessionIdVerficationException       If the node was not found and update is forced
         * @throws      UnexpectedValueException        If $resultInstance does not implement wanted interface
         */
-       public function registerNodeByMessageInstance (DeliverableMessage $messageInstance, HandleableDataSet $handlerInstance, bool $forceUpdate = FALSE) {
+       public function registerNodeByMessageInstance (DeliverableMessage $messageInstance, HandleableDataSet $handlerInstance, bool $forceUpdate = FALSE): void {
                // Get a search criteria class
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NODE-DHT-FACADE: state=%s,messageInstance=%s,handlerInstance=%s,forceUpdate=%d - CALLED', $this->getPrintableState(), $messageInstance->__toString(), $handlerInstance->__toString(), intval($forceUpdate)));
                $searchInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class');
@@ -317,7 +317,7 @@ class NodeDhtFacade extends BaseDht implements DistributableNode, Registerable {
         * @return      $nodeList                       An array with all found nodes
         * @throws      UnexpectedValueException        If $resultInstance does not implement wanted interface
         */
-       public function queryLocalNodeListExceptByMessageInstance (DeliverableMessage $messageInstance, HandleableDataSet $handlerInstance, string $excludeKey, string $andKey, string $separator) {
+       public function queryLocalNodeListExceptByMessageInstance (DeliverableMessage $messageInstance, HandleableDataSet $handlerInstance, string $excludeKey, string $andKey, string $separator): array {
                // Get a search criteria class
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NODE-DHT-FACADE: messageInstance=%s,handlerInstance=%s,excludeKey=%s,andKey=%s,separator=%s - CALLED!', $messageInstance->__toString(), $handlerInstance->__toString(), $excludeKey, $andKey, $separator));
                //* PRINTR-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NODE-DHT-FACADE: state=%s,messageInstance=%s', $this->getPrintableState(), print_r($messageInstance, TRUE)));
@@ -389,7 +389,7 @@ class NodeDhtFacade extends BaseDht implements DistributableNode, Registerable {
         * @param       $nodeList       An array from an earlier database result instance
         * @return      void
         */
-       public function insertNodeList (array $nodeList) {
+       public function insertNodeList (array $nodeList): void {
                // If no node is in the list (array), skip the rest of this method
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NODE-DHT-FACADE: nodeList()=%d - CALLED!', count($nodeList)));
                if (count($nodeList) == 0) {
@@ -415,7 +415,7 @@ class NodeDhtFacade extends BaseDht implements DistributableNode, Registerable {
         * @return      $recipients             An indexed array with DHT recipients
         * @throws      UnexpectedValueException        If $resultInstance does not implement wanted interface
         */
-       public function findRecipientsByPackageInstance (DeliverablePackage $packageInstance) {
+       public function findRecipientsByPackageInstance (DeliverablePackage $packageInstance): array {
                // Query get a result instance back from DHT database frontend
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NODE-DHT-FACADE: packageInstance=%s - CALLED!', $packageInstance->__toString()));
                $resultInstance = $this->getFrontendInstance()->getResultFromExcludedSender($packageInstance);
@@ -457,11 +457,11 @@ class NodeDhtFacade extends BaseDht implements DistributableNode, Registerable {
         *
         * @param       $key            Key to search for
         * @param       $value          Value to check on found key
-        * @return      $recipiens      Array with DHT recipients from given key/value pair
+        * @return      $recipients             Array with DHT recipients from given key/value pair
         * @throws      InvalidArgumentException        If $key is empty
         * @throws      UnexpectedValueException        If $resultInstance does not implement wanted interface
         */
-       public function findRecipientsByKey (string $key, $value) {
+       public function findRecipientsByKey (string $key, mixed $value): array {
                // Is key parameter valid?
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NODE-DHT-FACADE: key=%s,value[%s]=%s - CALLED!', $key, gettype($value), $value));
                if (empty($key)) {
index a8e639bd8439f50e99c005451b247d6420e3b53b..ee2092bbf0eca1afba0599922e0992adddcc0514 100644 (file)
@@ -51,9 +51,11 @@ class HubcoinRewardFeature extends BaseFeature implements Feature {
         */
        public final static function createHubcoinRewardFeature () {
                // Get a new instance
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('[%s:%d]: CALLED!', __METHOD__, __LINE__));
                $featureInstance = new HubcoinRewardFeature();
 
                // Return the prepared instance
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('[%s:%d]: featureInstance=%s - EXIT!', __METHOD__, __LINE__, $featureInstance->__toString()));
                return $featureInstance;
        }
 
@@ -64,11 +66,11 @@ class HubcoinRewardFeature extends BaseFeature implements Feature {
         */
        public function isFeatureAvailable () {
                // Testing this feature is pretty simple:
-               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[%s:%d]: CALLED!', __METHOD__, __LINE__));
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('[%s:%d]: CALLED!', __METHOD__, __LINE__));
                $isAvailable = ((FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('extension_scrypt_loaded') === TRUE) && (extension_loaded('scrypt')) && (is_callable('scrypt')));
 
                // Return status
-               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[%s:%d]: isAvailable=%d - EXIT!', __METHOD__, __LINE__, intval($isAvailable)));
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('[%s:%d]: isAvailable=%d - EXIT!', __METHOD__, __LINE__, intval($isAvailable)));
                return $isAvailable;
        }
 
@@ -84,14 +86,14 @@ class HubcoinRewardFeature extends BaseFeature implements Feature {
         */
        public function featureMethodGenerateHash ($data) {
                // Make sure the feature is available
-               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[%s:%d]: data()=%d - CALLED!', __METHOD__, __LINE__, strlen($data)));
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('[%s:%d]: data()=%d - CALLED!', __METHOD__, __LINE__, strlen($data)));
                assert(FrameworkFeature::isFeatureAvailable('hubcoin_reward'));
 
                // Call inner class
                $hash = Scrypt::hashScrypt($data);
 
                // Return generated hash
-               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[%s:%d]: hash=%s - EXIT!', __METHOD__, __LINE__, $hash));
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('[%s:%d]: hash=%s - EXIT!', __METHOD__, __LINE__, $hash));
                return $hash;
        }
 
@@ -104,14 +106,14 @@ class HubcoinRewardFeature extends BaseFeature implements Feature {
         */
        public function featureMethodCheckHash ($data, string $hash) {
                // Make sure the feature is available
-               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[%s:%d]: data()=%d,hash=%s - CALLED!', __METHOD__, __LINE__, strlen($data), $hash));
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('[%s:%d]: data()=%d,hash=%s - CALLED!', __METHOD__, __LINE__, strlen($data), $hash));
                assert(FrameworkFeature::isFeatureAvailable('hubcoin_reward'));
 
                // Determine it
                $isValid = Scrypt::checkScrypt($data, $hash);
 
                // Return status
-               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[%s:%d]: isValid=%d - EXIT!', __METHOD__, __LINE__, intval($isValid)));
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('[%s:%d]: isValid=%d - EXIT!', __METHOD__, __LINE__, intval($isValid)));
                return $isValid;
        }
 
index af5d18ac756152236177a6c84f76fec9cee8f1f0..be0128585467653b2f13c25290e5b4ceef1653e9 100644 (file)
@@ -80,7 +80,7 @@ class DefaultPeerPool extends BasePool implements PoolablePeer {
         */
        private function validateSocket (StorableSocket $socketInstance) {
                // Is it a valid resource?
-               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('HUB-SYSTEM: socketInstance->socketResource=%s - CALLED!', $socketInstance->getPrintableName()));
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('HUB-SYSTEM: socketInstance->socketResource=%s - CALLED!', $socketInstance->getPrintableName()));
                if (!$socketInstance->isValidSocket()) {
                        // Throw an exception
                        throw new InvalidSocketException([$this, $socketInstance->getSocketResource()], self::EXCEPTION_INVALID_SOCKET);
@@ -105,9 +105,9 @@ class DefaultPeerPool extends BasePool implements PoolablePeer {
         * @throws      InvalidArgumentException        If $connectionType is empty
         * @throws      InvalidConnectionTypeException  If the provided connection type is not valid
         */
-       public function addPeer (StorableSocket $socketInstance, string $connectionType) {
+       public function addPeer (StorableSocket $socketInstance, string $connectionType): void {
                // Validate parameter
-               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('DEFAULT-PEER-POOL: socketResource[%s]=%s,connectionType=%s - CALLED!', gettype($socketInstance->getSocketResource()), $socketInstance->getPrintableName(), $connectionType));
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('DEFAULT-PEER-POOL: socketResource[%s]=%s,connectionType=%s - CALLED!', gettype($socketInstance->getSocketResource()), $socketInstance->getPrintableName(), $connectionType));
                if (empty($connectionType)) {
                        // Throw exception
                        throw new InvalidArgumentException('Parameter "connectionType" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
@@ -157,12 +157,12 @@ class DefaultPeerPool extends BasePool implements PoolablePeer {
         *
         * @return      $sockets        An array with all sockets
         */
-       public final function getAllSockets () {
+       public final function getAllSockets (): array {
                // Get the list
                $sockets = $this->getArrayFromList('pool');
 
                // Return it
-               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('DEFAULT-PEER-POOL: sockets()=%d - EXIT!', count($sockets)));
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('DEFAULT-PEER-POOL: sockets()=%d - EXIT!', count($sockets)));
                return $sockets;
        }
 
@@ -171,7 +171,7 @@ class DefaultPeerPool extends BasePool implements PoolablePeer {
         *
         * @return      $sockets        An array with all socket arrays
         */
-       public final function getAllSingleSockets () {
+       public final function getAllSingleSockets (): array {
                // Get the array list
                $socketArrays = $this->getArrayFromList('pool');
 
@@ -196,9 +196,9 @@ class DefaultPeerPool extends BasePool implements PoolablePeer {
         * @throws      InvalidConnectionTypeException  If the found connection type is not valid
         * @throws      InvalidArgumentException        If $connectionType is empty
         */
-       public function getSocketsByConnectionType (string $connectionType) {
+       public function getSocketsByConnectionType (string $connectionType): array {
                // Validate parameter
-               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('DEFAULT-PEER-POOL: connectionType=%s - CALLED!', $connectionType));
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('DEFAULT-PEER-POOL: connectionType=%s - CALLED!', $connectionType));
                if (empty($connectionType)) {
                        // Throw exception
                        throw new InvalidArgumentException('Parameter "connectionType" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
@@ -241,7 +241,7 @@ class DefaultPeerPool extends BasePool implements PoolablePeer {
         */
        public function getSocketFromPackageInstance (DeliverablePackage $packageInstance, string $connectionType = NULL) {
                // Validate parameter
-               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('DEFAULT-PEER-POOL: packageInstance=%s,connectionType[%s]=%s - CALLED!', $packageInstance->__toString(), gettype($connectionType), $connectionType));
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('DEFAULT-PEER-POOL: packageInstance=%s,connectionType[%s]=%s - CALLED!', $packageInstance->__toString(), gettype($connectionType), $connectionType));
                if (empty($connectionType)) {
                        // Throw exception
                        throw new InvalidArgumentException('Parameter "connectionType" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
@@ -301,7 +301,7 @@ class DefaultPeerPool extends BasePool implements PoolablePeer {
                }
 
                // Return the determined socket instance
-               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('DEFAULT-PEER-POOL: socketInstance[]=%s - EXIT!', gettype($socketInstance)));
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('DEFAULT-PEER-POOL: socketInstance[]=%s - EXIT!', gettype($socketInstance)));
                return $socketInstance;
        }
 
index 056fb72ea2a4981239badad35f0eefedd0f5edf9..216407326a51fd1ce19affe03d01c03c6e00d62e 100644 (file)
@@ -97,7 +97,7 @@ class HubTools extends BaseHubSystem {
         *
         * @return      $sessionIdLength        Length of session ids
         */
-       protected final function getSessionIdLength () {
+       protected final function getSessionIdLength (): int {
                return $this->sessionIdLength;
        }
 
@@ -106,10 +106,10 @@ class HubTools extends BaseHubSystem {
         * is resolveSessionIdByUniversalNodeLocator()
         *
         * @param       $sessionId      A valid session id
-        * @return      $recipientUniversalNodeLocator  Recipient as Universal Node Locator
+        * @return      $recipientUn  Recipient as Universal Node Locator
         * @throws      InvalidArgumentException        If $sessionId is not valid
         */
-       protected function resolveUniversalNodeLocatorBySessionId (string $sessionId) {
+       protected function resolveUniversalNodeLocatorBySessionId (string $sessionId): string {
                // Validate parameter
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('HUB-TOOLS: sessionId=%s - CALLED!', $sessionId));
                if (empty($sessionId)) {
@@ -152,7 +152,7 @@ class HubTools extends BaseHubSystem {
         * @return      $nodeId         Node id
         * @throws      InvalidArgumentException        If $sessionId is not valid
         */
-       public static function resolveNodeIdBySessionId (string $sessionId) {
+       public static function resolveNodeIdBySessionId (string $sessionId): string {
                // Validate parameter
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('HUB-TOOLS: sessionId=%s - CALLED!', $sessionId));
                if (empty($sessionId)) {
@@ -182,7 +182,7 @@ class HubTools extends BaseHubSystem {
         * @param       $locatorInstance        An instance of a LocateableNode class
         * @return      $sessionId              Valid session id
         */
-       public static function resolveSessionIdByUniversalNodeLocator (LocateableNode $locatorInstance) {
+       public static function resolveSessionIdByUniversalNodeLocator (LocateableNode $locatorInstance): string {
                // Get an own instance
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('HUB-TOOLS: locatorInstance=%s - CALLED!', $locatorInstance->__toString()));
                $selfInstance = self::getSelfInstance();
@@ -215,7 +215,7 @@ class HubTools extends BaseHubSystem {
         * @throws      InvalidSessionIdException       If the provided session id is invalid (and no Universal Node Locator)
         * @throws      NoValidHostnameException        If the provided hostname cannot be resolved into an IP address
         */
-       public static function resolveSessionIdToUnl (string $address) {
+       public static function resolveSessionIdToUnl (string $address): string {
                // Is the parameter valid?
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('HUB-TOOLS: address=%s - CALLED!', $address));
                if (empty($address)) {
@@ -256,7 +256,7 @@ class HubTools extends BaseHubSystem {
         *
         * @return      $unl    The determined external UNL of this node
         */
-       public static function determineOwnExternalAddress () {
+       public static function determineOwnExternalAddress (): string {
                // Is the external_address config entry set?
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('HUB-TOOLS: CALLED!');
                if (isset(self::$cachedAddresses[DiscoverableUniversalNodeLocator::UNL_TYPE_EXTERNAL])) {
@@ -285,7 +285,7 @@ class HubTools extends BaseHubSystem {
         *
         * @return      $unl    The determined internal UNL of this node
         */
-       public static function determineOwnInternalAddress () {
+       public static function determineOwnInternalAddress (): string {
                // Is the internal_address config entry set?
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('HUB-TOOLS: CALLED!');
                if (isset(self::$cachedAddresses[DiscoverableUniversalNodeLocator::UNL_TYPE_INTERNAL])) {
@@ -338,7 +338,7 @@ class HubTools extends BaseHubSystem {
         *
         * @return      $externalUnl    External UNL
         */
-       public static function determineExternalUniversalNodeLocator () {
+       public static function determineExternalUniversalNodeLocator (): string {
                // Determine UNL based on this node:
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('HUB-TOOLS: CALLED!');
                // 1) Get discovery class
index f774c961cfd56a2b0fc62fc111c95308580610b6..568b5b2d193f3ad408ce350d274e9ed0e5164558 100644 (file)
@@ -52,7 +52,7 @@ class NodeLocatorUtils extends BaseHubSystem {
         * @param       $unl            Universal Node Locator to validate
         * @return      $isValid        Whether the UNL is valid
         */
-       public static function isValidUniversalNodeLocator (string $unl) {
+       public static function isValidUniversalNodeLocator (string $unl): bool {
                // Debug message
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('UNIVERSAL-NODE-LOCATOR: unl=' . $unl . ' - CALLED!');
 
index a917c75ec2b02971c069a7ddbd343b3784bb3267..6dff88b3b46dc14d9bc98d21b24266a82cae2663 100644 (file)
@@ -43,7 +43,7 @@ interface DistributableNode extends Distributable {
         * @return      $nodeData       Node-data array
         * @throws      InvalidArgumentException        If parameter $sessionId is not valid
         */
-       function findNodeLocalBySessionId (string $sessionId);
+       function findNodeLocalBySessionId (string $sessionId): array;
 
        /**
         * Finds a node locally by given UNL instance
@@ -51,7 +51,7 @@ interface DistributableNode extends Distributable {
         * @param       $locatorInstance        An instance of a LocateableNode class
         * @return      $nodeData       Node-data array
         */
-       function findNodeByUniversalNodeLocator (LocateableNode $locatorInstance);
+       function findNodeByUniversalNodeLocator (LocateableNode $locatorInstance): array;
 
        /**
         * Registers an other node with this node by given message data. The
@@ -66,7 +66,7 @@ interface DistributableNode extends Distributable {
         * @param       $forceUpdate            Optionally force update, don't register (default: register if not found)
         * @return      void
         */
-       function registerNodeByMessageInstance (DeliverableMessage $messageInstance, HandleableDataSet $handlerInstance, bool $forceUpdate = FALSE);
+       function registerNodeByMessageInstance (DeliverableMessage $messageInstance, HandleableDataSet $handlerInstance, bool $forceUpdate = FALSE): void;
 
        /**
         * Queries the local DHT data(base) for a node list with all supported
@@ -79,7 +79,7 @@ interface DistributableNode extends Distributable {
         * @param       $separator                      Sepator char (1st parameter for explode() call)
         * @return      $nodeList                       An array with all found nodes
         */
-       function queryLocalNodeListExceptByMessageInstance (DeliverableMessage $messageInstance, HandleableDataSet $handlerInstance, string $excludeKey, string $andKey, string $separator);
+       function queryLocalNodeListExceptByMessageInstance (DeliverableMessage $messageInstance, HandleableDataSet $handlerInstance, string $excludeKey, string $andKey, string $separator): array;
 
        /**
         * Inserts given node list array (from earlier database result produced by
@@ -89,21 +89,21 @@ interface DistributableNode extends Distributable {
         * @param       $nodeList       An array from an earlier database result instance
         * @return      void
         */
-       function insertNodeList (array $nodeList);
+       function insertNodeList (array $nodeList): void;
 
        /**
         * Checks whether there are entries in "INSERT" node data stack
         *
         * @return      $isPending      Whether there are pending entries
         */
-       function ifInsertNodeDataPending ();
+       function ifInsertNodeDataPending (): bool;
 
        /**
         * Checks whether there are unpublished entries
         *
         * @return      $hasUnpublished         Whether there are unpublished entries
         */
-       function hasUnpublishedEntries ();
+       function hasUnpublishedEntries (): bool;
 
        /**
         * Initializes publication of DHT entries. This does only prepare
@@ -112,14 +112,14 @@ interface DistributableNode extends Distributable {
         *
         * @return      void
         */
-       function initEntryPublication ();
+       function initEntryPublication (): void;
 
        /**
         * Checks whether there are entries pending publication
         *
         * @return      $isPending      Whether there are entries pending publication
         */
-       function hasEntriesPendingPublication ();
+       function hasEntriesPendingPublication (): bool;
 
        /**
         * Publishes next entry found in stack. This method shall also update the
@@ -127,6 +127,6 @@ interface DistributableNode extends Distributable {
         *
         * @return      void
         */
-       function publishEntry ();
+       function publishEntry (): void;
 
 }
index ddee9884bcbbcf2df3fc8e330b9b5d30a1d29871..5488d3e5f966cc430def55fd034fb8097757089b 100644 (file)
@@ -38,21 +38,21 @@ interface PoolablePeer extends Poolable, SocketTag {
         * @return      void
         * @throws      InvalidConnectionTypeException  If the provided connection type is not valid
         */
-       function addPeer (StorableSocket $socketInstance, string $connectionType);
+       function addPeer (StorableSocket $socketInstance, string $connectionType): void;
 
        /**
         * Getter for array of all socket resources
         *
         * @return      $sockets        An array with all sockets
         */
-       function getAllSockets ();
+       function getAllSockets (): array;
 
        /**
         * Getter for array of all socket arrays
         *
         * @return      $sockets        An array with all socket arrays
         */
-       function getAllSingleSockets ();
+       function getAllSingleSockets (): array;
 
        /**
         * "Getter" for all sockets of specified type
diff --git a/core b/core
index cc9a1193fe856148b71982e055dd05051751cef2..ba75c20fcc3cc172de195703b3220168d97912fd 160000 (submodule)
--- a/core
+++ b/core
@@ -1 +1 @@
-Subproject commit cc9a1193fe856148b71982e055dd05051751cef2
+Subproject commit ba75c20fcc3cc172de195703b3220168d97912fd