]> git.mxchange.org Git - hub.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Fri, 4 Dec 2020 06:40:30 +0000 (07:40 +0100)
committerRoland Häder <roland@mxchange.org>
Fri, 4 Dec 2020 06:40:30 +0000 (07:40 +0100)
- lesser old-lost " // END - *
- also converted assert() into proper thrown exceptions (more OOP)
- updated core framework

Signed-off-by: Roland Häder <roland@mxchange.org>
110 files changed:
application/hub/class_ApplicationHelper.php
application/hub/classes/chains/class_PackageFilterChain.php
application/hub/classes/client/http/class_HttpClient.php
application/hub/classes/commands/console/class_HubConsoleAptProxyCommand.php
application/hub/classes/commands/console/class_HubConsoleChatCommand.php
application/hub/classes/commands/console/class_HubConsoleCrawlerCommand.php
application/hub/classes/commands/console/class_HubConsoleCruncherCommand.php
application/hub/classes/commands/console/class_HubConsoleMainCommand.php
application/hub/classes/commands/console/class_HubConsoleMinerCommand.php
application/hub/classes/commands/html/class_HubHtmlIndexCommand.php
application/hub/classes/controller/console/class_HubConsoleAptProxyController.php
application/hub/classes/controller/console/class_HubConsoleChatController.php
application/hub/classes/controller/console/class_HubConsoleCrawlerController.php
application/hub/classes/controller/console/class_HubConsoleCruncherController.php
application/hub/classes/controller/console/class_HubConsoleDefaultNewsController.php
application/hub/classes/controller/console/class_HubConsoleFuseController.php
application/hub/classes/controller/console/class_HubConsoleMinerController.php
application/hub/classes/cruncher/class_BaseHubCruncher.php
application/hub/classes/cruncher/openssl/class_HubOpenSslCruncher.php
application/hub/classes/database/frontend/node_dht/class_NodeDistributedHashTableDatabaseFrontend.php
application/hub/classes/decoder/package/class_PackageDecoder.php
application/hub/classes/dht/class_BaseDht.php
application/hub/classes/discovery/node/class_UniversalNodeLocatorDiscovery.php
application/hub/classes/discovery/recipient/socket/class_PackageSocketDiscovery.php
application/hub/classes/factories/chain/class_PackageFilterChainFactory.php
application/hub/classes/factories/client/class_ClientFactory.php
application/hub/classes/factories/states/node/class_NodeStateFactory.php
application/hub/classes/factories/states/peer/class_PeerStateFactory.php
application/hub/classes/filter/apt-proxy/class_AptProxyPhpRequirementsFilter.php
application/hub/classes/filter/chat/class_ChatPhpRequirementsFilter.php
application/hub/classes/filter/class_BaseHubFilter.php
application/hub/classes/filter/crawler/class_CrawlerPhpRequirementsFilter.php
application/hub/classes/filter/cruncher/class_CruncherPhpRequirementsFilter.php
application/hub/classes/filter/miner/class_MinerPhpRequirementsFilter.php
application/hub/classes/filter/node/class_NodePhpRequirementsFilter.php
application/hub/classes/filter/task/crawler/class_CrawlerTaskHandlerInitializerFilter.php
application/hub/classes/handler/chunks/class_ChunkHandler.php
application/hub/classes/handler/data/message-types/announcement/class_NodeMessageAnnouncementHandler.php
application/hub/classes/handler/data/message-types/answer/class_NodeMessageAnnouncementAnswerHandler.php
application/hub/classes/handler/data/message-types/answer/class_NodeMessageDhtBootstrapAnswerHandler.php
application/hub/classes/handler/data/message-types/answer/class_NodeMessageRequestNodeListAnswerHandler.php
application/hub/classes/handler/data/message-types/class_BaseMessageHandler.php
application/hub/classes/handler/data/message-types/dht/class_NodeMessageDhtBootstrapHandler.php
application/hub/classes/handler/data/message-types/requests/class_NodeMessageRequestNodeListHandler.php
application/hub/classes/handler/package/class_NetworkPackageHandler.php
application/hub/classes/handler/protocol/ipv4/class_BaseIpV4ProtocolHandler.php
application/hub/classes/handler/raw_data/tcp/class_TcpRawDataHandler.php
application/hub/classes/helper/connection/ipv4/tcp/class_TcpConnectionHelper.php
application/hub/classes/info/connection/class_ConnectionInfo.php
application/hub/classes/iterator/network/class_NetworkListenIterator.php
application/hub/classes/iterator/pool/handler/class_HandlerPoolIterator.php
application/hub/classes/iterator/pool/monitor/class_MonitorPoolIterator.php
application/hub/classes/iterator/pool/shutdown/class_ShutdownPoolIterator.php
application/hub/classes/iterator/pool/tasks/class_TaskPoolIterator.php
application/hub/classes/listener/class_BaseListener.php
application/hub/classes/listener/class_BaseListenerDecorator.php
application/hub/classes/listener/socket/class_SocketFileListener.php
application/hub/classes/listener/tcp/decorators/class_ClientTcpListenerDecorator.php
application/hub/classes/listener/tcp/decorators/class_HubTcpListenerDecorator.php
application/hub/classes/listener/udp/decorators/class_ClientUdpListenerDecorator.php
application/hub/classes/listener/udp/decorators/class_HubUdpListenerDecorator.php
application/hub/classes/locator/class_UniversalNodeLocator.php
application/hub/classes/miner/chash/class_HubCoinMiner.php
application/hub/classes/miner/class_BaseHubMiner.php
application/hub/classes/package/assembler/class_PackageAssembler.php
application/hub/classes/package/fragmenter/class_PackageFragmenter.php
application/hub/classes/pools/class_BasePool.php
application/hub/classes/producer/cruncher/keys/cruncher/class_CruncherKeyProducer.php
application/hub/classes/recipient/direct/class_DirectRecipient.php
application/hub/classes/recipient/self/class_SelfRecipient.php
application/hub/classes/recipient/upper/class_UpperRecipient.php
application/hub/classes/registry/objects/class_ObjectTypeRegistry.php
application/hub/classes/resolver/controller/console/class_HubConsoleControllerResolver.php
application/hub/classes/resolver/controller/html/class_HubHtmlControllerResolver.php
application/hub/classes/resolver/protocol/tcp/class_TcpProtocolResolver.php
application/hub/classes/resolver/state/class_BaseStateResolver.php
application/hub/classes/resolver/state/peer/class_PeerStateResolver.php
application/hub/classes/source/urls/class_CrawlerUploadedListUrlSource.php
application/hub/classes/states/communicator/class_BaseCommunicatorState.php
application/hub/classes/states/crawler/class_BaseCrawlerState.php
application/hub/classes/states/cruncher/class_BaseCruncherState.php
application/hub/classes/states/dht/class_BaseDhtState.php
application/hub/classes/states/miner/booting/class_MinerBootingState.php
application/hub/classes/states/miner/class_BaseMinerState.php
application/hub/classes/states/node/class_BaseNodeState.php
application/hub/classes/states/peer/class_BasePeerState.php
application/hub/classes/streams/raw_data/input/class_RawDataInputStream.php
application/hub/classes/tags/package/class_PackageTags.php
application/hub/classes/tasks/crawler/url_source/class_CrawlerUrlSourceFoundRssTask.php
application/hub/classes/tasks/crawler/url_source/class_CrawlerUrlSourceLocalStartTask.php
application/hub/classes/tasks/crawler/url_source/class_CrawlerUrlSourceRssStartTask.php
application/hub/classes/tasks/crawler/url_source/class_CrawlerUrlSourceUploadedListTask.php
application/hub/classes/tasks/node/dht/class_NodeDhtPublicationCheckTask.php
application/hub/classes/tasks/node/dht/class_NodeDhtPublicationTask.php
application/hub/classes/tasks/node/dht/class_NodeDhtQueryTask.php
application/hub/classes/template/xml/announcement/class_XmlAnnouncementTemplateEngine.php
application/hub/classes/template/xml/answer/announcement/class_XmlAnnouncementAnswerTemplateEngine.php
application/hub/classes/template/xml/answer/dht/class_XmlDhtBootstrapAnswerTemplateEngine.php
application/hub/classes/template/xml/answer/requests/class_XmlRequestNodeListAnswerTemplateEngine.php
application/hub/classes/template/xml/connect/class_XmlSelfConnectTemplateEngine.php
application/hub/classes/template/xml/dht/publish/class_XmlDhtPublishEntryTemplateEngine.php
application/hub/classes/template/xml/entries/class_XmlRequestNodeListEntryTemplateEngine.php
application/hub/classes/template/xml/objects/class_XmlObjectRegistryTemplateEngine.php
application/hub/classes/template/xml/producer/test_units/class_XmlCruncherTestUnitTemplateEngine.php
application/hub/classes/template/xml/requests/class_XmlRequestNodeListTemplateEngine.php
application/hub/classes/tools/hub/class_HubTools.php
application/hub/exceptions.php
contrib/mhash-benchmark.php
contrib/udp-client.php
core

index 8545f70a71566c20d1264f62f5383ffd3a55d70d..65cb781ce4b7ecc40d393c41c32a443092ab82d1 100644 (file)
@@ -73,7 +73,7 @@ class ApplicationHelper extends BaseApplication implements ManageableApplication
                // Is the instance there?
                if (is_null(self::getApplicationInstance())) {
                        self::setApplicationInstance(new ApplicationHelper());
-               } // END - if
+               }
 
                // Return the instance
                return self::getApplicationInstance();
@@ -136,7 +136,7 @@ class ApplicationHelper extends BaseApplication implements ManageableApplication
 
                        // Set it in request
                        $requestInstance->setRequestElement('command', $commandName);
-               } // END - if
+               }
 
                // Is the request type 'html' ?
                if (FrameworkBootstrap::getRequestTypeFromSystem() == 'html') {
@@ -145,7 +145,7 @@ class ApplicationHelper extends BaseApplication implements ManageableApplication
 
                        // And set it here
                        $this->setLanguageInstance($languageInstance);
-               } // END - if
+               }
 
                // Configuration entry key
                $configEntry = sprintf(
@@ -173,7 +173,7 @@ class ApplicationHelper extends BaseApplication implements ManageableApplication
                        self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('MAIN: Shutdown in progress, main loop exited.');
                        $this->getControllerInstance()->executeShutdownFilters($requestInstance, $responseInstance);
                        self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('MAIN: Shutdown completed. (This is the last line.)');
-               } // END - if
+               }
        }
 
        /**
@@ -197,7 +197,7 @@ class ApplicationHelper extends BaseApplication implements ManageableApplication
                // Walk through all messages
                foreach ($messageList as $message) {
                        exit(__METHOD__ . ':MSG:' . $message);
-               } // END - foreach
+               }
        }
 
        /**
index 29e2c3429a88cf735d8209538202f377d646a570..473b88780afecfbce9042f3e4f8a25c90fe0c23d 100644 (file)
@@ -74,7 +74,7 @@ class PackageFilterChain extends FilterChain {
                                self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('Failed to execute lase filter ' . $filterInstance->__toString() . ': ' . $e->getMessage());
                                break;
                        }
-               } // END - foreach
+               }
        }
 
        /**
@@ -95,7 +95,7 @@ class PackageFilterChain extends FilterChain {
                                self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('Failed to execute lase filter ' . $filterInstance->__toString() . ': ' . $e->getMessage());
                                break;
                        }
-               } // END - foreach
+               }
        }
 
 }
index f48334e3a32a7947a4172c44a185c0bcbc5c422d..cd943ad768fac783b87825a3f7d466d90591dba6 100644 (file)
@@ -74,7 +74,7 @@ class HttpClient extends BaseClient implements Client {
                                        FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('proxy_port') > 0
                                )
                        );
-               } // END - if
+               }
 
                // Return cache
                return $GLOBALS[__METHOD__];
@@ -98,7 +98,7 @@ class HttpClient extends BaseClient implements Client {
                if (((strtolower($respArray[0]) !== 'http/1.0') && (strtolower($respArray[0]) !== 'http/1.1')) || ($respArray[1] != '200')) {
                        // Response code is not 200
                        return $response;
-               } // END - if
+               }
 
                // All fine!
                return $respArray;
@@ -122,7 +122,7 @@ class HttpClient extends BaseClient implements Client {
                        // Add it as well
                        $encodedAuth = base64_encode(FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('proxy_username') . ':' . FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('proxy_password'));
                        $rawRequest .= 'Proxy-Authorization: Basic ' . $encodedAuth . self::HTTP_EOL;
-               } // END - if
+               }
 
                // Add last new-line
                $rawRequest .= self::HTTP_EOL;
@@ -135,7 +135,7 @@ class HttpClient extends BaseClient implements Client {
                if (feof($this->getSocketInstance())) {
                        // No response received
                        return $response;
-               } // END - if
+               }
 
                // Read the first line
                $resp = trim(fgets($this->getSocketInstance(), 10240));
index bc40a927330865df2308f5a11f9c65dca6863ba5..81883d6afa8ff777cc7b627dd71d35c46ef08b31 100644 (file)
@@ -105,7 +105,7 @@ class HubConsoleAptProxyCommand extends BaseCommand implements Commandable {
                while (($proxyInstance->isActive()) && ($handlerInstance->hasTasksLeft())) {
                        // Handle all tasks here
                        $handlerInstance->handleTasks();
-               } // END - while
+               }
 
                // Debug message
                self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('MAIN: --- Leaving main loop. ---');
index 044b3abca3c509e0ef1979582bc459d5d29ea8f7..a4b37312ec3f9a0c80cda017c8c240b09ac7954f 100644 (file)
@@ -105,7 +105,7 @@ class HubConsoleChatCommand extends BaseCommand implements Commandable {
                while (($chatInstance->isActive()) && ($handlerInstance->hasTasksLeft())) {
                        // Handle all tasks here
                        $handlerInstance->handleTasks();
-               } // END - while
+               }
 
                // Debug message
                self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('MAIN: --- Leaving main loop. ---');
index 2eb9830b645d9ae9579e1325e9d15119313df497..fe4204ca798ab95bb8098e7a3d2c193cbc363fc2 100644 (file)
@@ -105,7 +105,7 @@ class HubConsoleCrawlerCommand extends BaseCommand implements Commandable {
                while (($crawlerInstance->isActive()) && ($handlerInstance->hasTasksLeft())) {
                        // Handle all tasks here
                        $handlerInstance->handleTasks();
-               } // END - while
+               }
 
                // Debug message
                self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('MAIN: --- Leaving main loop. ---');
index 0f16239093f4db361d1a03c58d6862c0e46d09df..109f49a1717085d5440175f431d6ba3af8a6c4ca 100644 (file)
@@ -105,7 +105,7 @@ class HubConsoleCruncherCommand extends BaseCommand implements Commandable {
                while (($cruncherInstance->isActive()) && ($handlerInstance->hasTasksLeft())) {
                        // Handle all tasks here
                        $handlerInstance->handleTasks();
-               } // END - while
+               }
 
                // Debug message
                self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('MAIN: --- Leaving main loop. ---');
index 092eeaba7e415e4872cefcc5f185ef10baa1a082..14e6a2276470c7a73ef2cde9ab90b1cdb5eab2c7 100644 (file)
@@ -116,7 +116,7 @@ class HubConsoleMainCommand extends BaseCommand implements Commandable {
                while (($nodeInstance->isNodeActive()) && ($handlerInstance->hasTasksLeft())) {
                        // Handle all tasks here
                        $handlerInstance->handleTasks();
-               } // END - while
+               }
 
                // Debug message
                self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('MAIN: --- Leaving main loop. ---');
index ba86d25d245c3be6cd034a4209903f0aad793340..4840fa61f178bd49da28d97555212e92085617f4 100644 (file)
@@ -105,7 +105,7 @@ class HubConsoleMinerCommand extends BaseCommand implements Commandable {
                while (($minerInstance->isActive()) && ($handlerInstance->hasTasksLeft())) {
                        // Handle all tasks here
                        $handlerInstance->handleTasks();
-               } // END - while
+               }
 
                // Debug message
                self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('MAIN: --- Leaving main loop. ---');
index df027ec085fcc613cf1e8c02294d46cf08ba6309..d9ac5a7ee01df68217de3d6317965a4450906200 100644 (file)
@@ -76,7 +76,7 @@ class HubHtmlIndexCommand extends BaseCommand implements Commandable {
 
                        // Bail out
                        exit();
-               } // END - if
+               }
 
                /*
                 * This is a generic HTML request, this means that a regular page with
index 876b687fbcbd11f6cd3538a2db1db468e8d18a09..8949bbc29c880797455b1cc836fd9a47e62e8427 100644 (file)
@@ -43,9 +43,9 @@ class HubConsoleAptProxyController extends BaseController implements Controller
                parent::__construct(__CLASS__);
 
                // Init additional filter chains
-               foreach (array('bootstrap','shutdown') as $filterChain) {
+               foreach (['bootstrap', 'shutdown'] as $filterChain) {
                        $this->initFilterChain($filterChain);
-               } // END - foreach
+               }
        }
 
        /**
index e28cbb6ae10b3600cd39c599d7a2e158fa35cff7..f9e445bb30bb940ec6c4a001e8f66b5d3be4f90a 100644 (file)
@@ -43,9 +43,9 @@ class HubConsoleChatController extends BaseController implements Controller {
                parent::__construct(__CLASS__);
 
                // Init additional filter chains
-               foreach (array('bootstrap','shutdown') as $filterChain) {
+               foreach (['bootstrap', 'shutdown'] as $filterChain) {
                        $this->initFilterChain($filterChain);
-               } // END - foreach
+               }
        }
 
        /**
index c837025306edb3d5c75149dc4ec0ecb57b4f0ab4..aabaff5339406a14aff97ca0e8bc3974a70e68c7 100644 (file)
@@ -43,9 +43,9 @@ class HubConsoleCrawlerController extends BaseController implements Controller {
                parent::__construct(__CLASS__);
 
                // Init additional filter chains
-               foreach (array('bootstrap','shutdown') as $filterChain) {
+               foreach (['bootstrap', 'shutdown'] as $filterChain) {
                        $this->initFilterChain($filterChain);
-               } // END - foreach
+               }
        }
 
        /**
index 8be958b38ef78daa2c1d4b45c33b74d674691ee8..48f1293a36c23c78ac81aa6b544a30d75375b3ed 100644 (file)
@@ -44,9 +44,9 @@ class HubConsoleCruncherController extends BaseController implements Controller
                parent::__construct(__CLASS__);
 
                // Init additional filter chains
-               foreach (array('bootstrap','shutdown') as $filterChain) {
+               foreach (['bootstrap', 'shutdown'] as $filterChain) {
                        $this->initFilterChain($filterChain);
-               } // END - foreach
+               }
        }
 
        /**
index f0108d5b3305e73808419f9a927c41522e6f25db..b40b69f533b17e905f43b9feb6d04f9735985dfb 100644 (file)
@@ -44,9 +44,9 @@ class HubConsoleDefaultNewsController extends BaseController implements Controll
                parent::__construct(__CLASS__);
 
                // Init additional filter chains
-               foreach (array('bootstrap', 'activation','shutdown') as $filterChain) {
+               foreach (['bootstrap', 'activation', 'shutdown'] as $filterChain) {
                        $this->initFilterChain($filterChain);
-               } // END - foreach
+               }
        }
 
        /**
index 4d1b7838d6b8282fe7eb58996ece82f224c86859..8ed7d00d1b6cda8eedbe127c80c1304543bbcfea 100644 (file)
@@ -43,9 +43,9 @@ class HubConsoleFuseController extends BaseController implements Controller {
                parent::__construct(__CLASS__);
 
                // Init additional filter chains
-               foreach (array('bootstrap','shutdown') as $filterChain) {
+               foreach (['bootstrap', 'shutdown'] as $filterChain) {
                        $this->initFilterChain($filterChain);
-               } // END - foreach
+               }
        }
 
        /**
index bc9ca93fb96eee9e66fc1be31d7e3253a834df0f..e9a4c0394f5803de5717a835b62d8b20e94e782f 100644 (file)
@@ -43,9 +43,9 @@ class HubConsoleMinerController extends BaseController implements Controller {
                parent::__construct(__CLASS__);
 
                // Init additional filter chains
-               foreach (array('bootstrap','shutdown') as $filterChain) {
+               foreach (['bootstrap', 'shutdown'] as $filterChain) {
                        $this->initFilterChain($filterChain);
-               } // END - foreach
+               }
        }
 
        /**
index 949c24b0a8e6eb50777b205d8ae78c0c0820ad49..ef11ced9b428f1b0fa2f48e1df273d521b3d823d 100644 (file)
@@ -202,8 +202,8 @@ abstract class BaseHubCruncher extends BaseHubSystem implements Updateable {
                        if ((!$this->isInBufferQueueFilled()) && (FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('cruncher_test_units_enabled') == 'Y')) {
                                // Then fill the in-buffer with (one) test-unit(s)
                                $this->fillInBufferQueueWithTestUnits();
-                       } // END - if
-               } // END - if
+                       }
+               }
        }
 
        /**
index 43327051aceac274de6fbdababe10539a5d06980..7050734c2c938a6e3ce4c8728ce607c4aac9ee39 100644 (file)
@@ -93,7 +93,7 @@ class HubOpenSslCruncher extends BaseHubCruncher implements CruncherHelper, Regi
 
                        // ... and finally queue it to the in-buffer queue
                        $this->queueUnitInstanceToInBuffer($unitInstance);
-               } // END - for
+               }
        }
 
        /**
@@ -107,7 +107,7 @@ class HubOpenSslCruncher extends BaseHubCruncher implements CruncherHelper, Regi
                if ($this->getStateInstance()->isCruncherStateVirgin()) {
                        // We can silently skip here, until the generation is finished
                        return;
-               } // END - if
+               }
 
                // @TODO Implement this method
                $this->partialStub('Please implement this method.');
index b3ddc7baf2ec3e8364aca1178e5a9fd1cbe7d42c..62d1f379da4c9cc72b12308748deaf5c4bcd28d7 100644 (file)
@@ -20,6 +20,7 @@ use Org\Mxchange\CoreFramework\Registry\Registerable;
 use Org\Mxchange\CoreFramework\Result\Search\SearchableResult;
 
 // Import SPL stuff
+use \BadMethodCallException;
 use \InvalidArgumentException;
 
 /**
@@ -277,13 +278,15 @@ class NodeDistributedHashTableDatabaseFrontend extends BaseHubDatabaseFrontend i
         * session id, ip number (and/or hostname) and port number.
         *
         * @return      void
+        * @throws      BadMethodCallException  If node is not locally registered
         */
        public function updateLocalNode () {
-               // Debug message
+               // Check condition
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-FRONTEND: CALLED!');
-
-               // Assert to make sure this method is called with one record in DB (the actual backend of the DHT)
-               assert($this->isLocalNodeRegistered());
+               if (!$this->isLocalNodeRegistered()) {
+                       // Not registered but methoded invoked
+                       throw new BadMethodCallException('Node is not locally registered but method called');
+               }
 
                // Get search criteria
                $searchInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class');
@@ -480,7 +483,7 @@ class NodeDistributedHashTableDatabaseFrontend extends BaseHubDatabaseFrontend i
                if ($this->isNodeRegistered($nodeData)) {
                        // Throw an exception
                        throw new NodeAlreadyRegisteredException(array($this, $nodeData), self::EXCEPTION_NODE_ALREADY_REGISTERED);
-               } // END - if
+               }
 
                // @TODO Unimplemented part
                $this->partialStub('nodeData=' . print_r($nodeData, TRUE));
@@ -513,7 +516,7 @@ class NodeDistributedHashTableDatabaseFrontend extends BaseHubDatabaseFrontend i
                if (!$this->isNodeRegistered($nodeData)) {
                        // No, then throw an exception
                        throw new NodeDataMissingException(array($this, $nodeData), self::EXCEPTION_NODE_NOT_REGISTERED);
-               } // END - if
+               }
 
                // Get a search instance
                $searchInstance = $this->prepareSearchInstance($nodeData);
index cfdcab6b7f51a5f7f7552643cf940f05f689c888..b8007a8fb43f62e095acc45fda8d7883f3fbb5cb 100644 (file)
@@ -15,6 +15,9 @@ use Org\Shipsimu\Hub\Handler\Package\NetworkPackageHandler;
 // Import framework stuff
 use Org\Mxchange\CoreFramework\Registry\Registerable;
 
+// Import SPL stuff
+use \BadMethodCallException;
+
 /**
  * A Package decoder class
  *
@@ -97,11 +100,15 @@ class PackageDecoder extends BaseDecoder implements Decodeable, Registerable {
         * Handles raw package data by decoding it
         *
         * @return      void
+        * @throws      BadMethodCallException  If no unhandled package data is pending
         */
        public function handleRawPackageData () {
                // Assert on it to make sure the next popNamed() call won't throw an exception
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-DECODER: CALLED!');
-               assert($this->ifUnhandledRawPackageDataLeft());
+               if (!$this->ifUnhandledRawPackageDataLeft()) {
+                       // No unhandled package data pending
+                       throw new BadMethodCallException('No unhandled package data is pending but method called');
+               }
 
                // "Pop" the next raw package content
                $rawPackageContent = $this->getHandlerInstance()->getStackInstance()->popNamed(ChunkHandler::STACKER_NAME_ASSEMBLED_RAW_DATA);
@@ -146,10 +153,14 @@ class PackageDecoder extends BaseDecoder implements Decodeable, Registerable {
         * Handles received decoded packages internally (recipient is this node)
         *
         * @return      void
+        * @throws      BadMethodCallException  If no decoded packages are left
         */
        public function handleDecodedPackage () {
-               // Assert on amount
-               assert($this->ifDeocedPackagesLeft());
+               // Check condition
+               if (!$this->ifDeocedPackagesLeft()) {
+                       // No decoded packages left
+                       throw new BadMethodCallException('No decoded packages pending but method called');
+               }
 
                // Get the next entry (assoziative array)
                $packageInstance = $this->getHandlerInstance()->getStackInstance()->popNamed(self::STACKER_NAME_DECODED_PACKAGE);
index e3a6f01e5dda89a43150d15ab5233b04998252d3..9ba58d1a3a8d9c8dcb7f04114c9e0204370ef26f 100644 (file)
@@ -253,7 +253,7 @@ abstract class BaseDht extends BaseHubSystem implements Distributable {
                if (!$this->publishHelperInstance instanceof HelpableDht) {
                        // Get a helper instance
                        $this->publishHelperInstance = ObjectFactory::createObjectByConfiguredName('dht_publish_entry_helper_class');
-               } // END - if
+               }
 
                // Load the announcement descriptor
                $this->publishHelperInstance->loadDescriptorXml($this);
index 97c7f07ba1b0e778f289c5d89be657e82d829887..b27d3226b381e006f06849e8ed6dd68c82826530 100644 (file)
@@ -78,7 +78,7 @@ class UniversalNodeLocatorDiscovery extends BaseNodeDiscovery implements Discove
                if (is_null($locatorInstance)) {
                        // Throw NPE here
                        throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER);
-               } // END - if
+               }
 
                // ... and return it
                return $locatorInstance;
@@ -112,7 +112,7 @@ class UniversalNodeLocatorDiscovery extends BaseNodeDiscovery implements Discove
 
                        // Get back the full UNL
                        $GLOBALS[__METHOD__][$configKey] = $resolverInstance->resolveUniversalNodeLocatorFromConfigKey($configKey);
-               } // END - if
+               }
 
                // Return cached value
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('UNL-DISCOVERY:configKey=' . $configKey . ',unl=' . $GLOBALS[__METHOD__][$configKey] . ' - EXIT!');
index a631ca43d24536753e8bcf86c63e807bfe587a01..07fb9e4b3ea92b4ad1812431f2c53e3850baea5a 100644 (file)
@@ -124,11 +124,11 @@ class PackageSocketDiscovery extends BaseRecipientDiscovery implements Discovera
                                // This listener likes our package data, so abort here
                                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('PACKAGE-SOCKET-DISCOVERY: Listener "%s" is accepting package data.', $listenerInstance->__toString()));
                                break;
-                       } // END - if
+                       }
 
                        // Debug message
                        /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-SOCKET-DISCOVERY: Listener is NOT accepting package data.');
-               } // END - foreach
+               }
 
                // Return it
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-SOCKET-DISCOVERY: listenerInstance=' . $listenerInstance->__toString() . ' - EXIT!');
index 72d027f51c2298c51ddd312fa099832da81e9baa..0e34a98e96d861785ee6640d4211c2df85f42a92 100644 (file)
@@ -69,7 +69,7 @@ class PackageFilterChainFactory extends ObjectFactory {
 
                                // Add this filter to the chain
                                $chainInstance->addFilter($filterInstance);
-                       } // END - foreach
+                       }
 
                        // Add the finished chain to the registry
                        GenericRegistry::getRegistry()->addInstance($registryKey, $chainInstance);
index c5349db5b50df48e1f6e647c71f53aae0d2d45be..ac8f1d957f111161bfeb835c4308e2d6948f204e 100644 (file)
@@ -69,7 +69,7 @@ class ClientFactory extends ObjectFactory {
                        if ($socketInstance instanceof StorableSocket) {
                                // Set socket instance
                                $clientInstance->setSocketInstance($socketInstance);
-                       } // END - if
+                       }
                } else {
                        // Generate object instance
                        $clientInstance = self::createObjectByConfiguredName($registryKey, array($socketInstance));
index 2086cf0a4865224035c52533ec027c4ff5500add..8925966a3328a09f9b993f24e9d116fee5e50ecf 100644 (file)
@@ -59,7 +59,7 @@ class NodeStateFactory extends ObjectFactory {
                        // Get node instance from registry
                        /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NOTE-STATE-FACTORY: Creating node instance ...');
                        $nodeInstance = NodeObjectFactory::createNodeInstance();
-               } // END - if
+               }
 
                // Get a class from that configuration entry
                $stateInstance = self::createObjectByConfiguredName($className, array($nodeInstance));
index 57672dbfe78f50de8b8854cc85dc12bec0532a09..43809e644eec33efa28bf77df8ff85f6e768d9a4 100644 (file)
@@ -63,7 +63,7 @@ class PeerStateFactory extends ObjectFactory {
                if (is_null(self::$tableInstance)) {
                        // Get a new one
                        self::$tableInstance = self::createObjectByConfiguredName('peer_state_lookup_db_frontend_class');
-               } // END - if
+               }
 
                // Return it
                return self::$tableInstance;
index 980ca8ccdaf2ecc51f1d719b90680508e7a8dd9f..af104b982255d72cc87f2db74a6682f07b5e4eda 100644 (file)
@@ -78,9 +78,7 @@ class AptProxyPhpRequirementsFilter extends BaseAptProxyFilter implements Filter
                if ($checkPassed === FALSE) {
                        // Throw an exception
                        throw new FilterChainException($this, self::FILTER_CHAIN_INTERCEPTED);
-               } // END - if
+               }
        }
-}
 
-// [EOF]
-?>
+}
index f4f9050132c552a77cddfd34c958fd71d9081574..49c52bcb2936926cd4d2d2a04be662078d0614e4 100644 (file)
@@ -78,9 +78,7 @@ class ChatPhpRequirementsFilter extends BaseChatFilter implements Filterable {
                if ($checkPassed === FALSE) {
                        // Throw an exception
                        throw new FilterChainException($this, self::FILTER_CHAIN_INTERCEPTED);
-               } // END - if
+               }
        }
-}
 
-// [EOF]
-?>
+}
index a0252091c9d28685f2995b9437e9b3a699f35c2c..e5f232222cb87f3189b55ac78f23b1199658c397 100644 (file)
@@ -100,14 +100,14 @@ abstract class BaseHubFilter extends BaseFilter {
 
                                // Skip this part, don't write NULLs to the array
                                continue;
-                       } // END - if
+                       }
 
                        // Debug message
                        /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(str_replace('_', '-', strtoupper($messageType)) . '-TAG: key=' . $key . ',value=' . $value);
 
                        // Set it now
                        $this->dataXmlNodes[$key] = $value;
-               } // END - foreach
+               }
 
                // Construct an array for pushing it on next stack
                $messageArray = array(
index 8bdba5bef9ce7c8fab10bb4c9dc96737707c2df1..758bafea7c5ce5141418a654097a784005b859bf 100644 (file)
@@ -81,9 +81,7 @@ class CrawlerPhpRequirementsFilter extends BaseCrawlerFilter implements Filterab
                if ($checkPassed === FALSE) {
                        // Throw an exception
                        throw new FilterChainException($this, self::FILTER_CHAIN_INTERCEPTED);
-               } // END - if
+               }
        }
-}
 
-// [EOF]
-?>
+}
index 718fc0b5abf517199d9078059860303bfab93f07..e9d18a5ea19272efc9ea34a6bab0683504a12559 100644 (file)
@@ -81,9 +81,7 @@ class CruncherPhpRequirementsFilter extends BaseCruncherFilter implements Filter
                if ($checkPassed === FALSE) {
                        // Throw an exception
                        throw new FilterChainException($this, self::FILTER_CHAIN_INTERCEPTED);
-               } // END - if
+               }
        }
-}
 
-// [EOF]
-?>
+}
index 2ac4b90e60ee7b847ad679df2d9550c6c0834b26..4c1a50bac1a836e82555430cf811f2ea7cc1bb05 100644 (file)
@@ -92,7 +92,7 @@ class MinerPhpRequirementsFilter extends BaseMinerFilter implements Filterable {
                if ($checkPassed === FALSE) {
                        // Throw an exception
                        throw new FilterChainException($this, self::FILTER_CHAIN_INTERCEPTED);
-               } // END - if
+               }
        }
 
 }
index c4eee7dbcc01b52f998bcf8570c3a8fba02ac7df..962a4ef319c5e2bff754e834902f7a4da885ab5d 100644 (file)
@@ -76,7 +76,7 @@ class NodePhpRequirementsFilter extends BaseNodeFilter implements Filterable {
                        // Test failed
                        $checkPassed = FALSE;
                        $checksFailed++;
-               } // END - if
+               }
 
                // If scrypt() is not found (ext-scrypt) then the "Hubcoins reward" is not working
                if ((extension_loaded('scrypt')) && (is_callable('scrypt'))) {
@@ -102,7 +102,7 @@ class NodePhpRequirementsFilter extends BaseNodeFilter implements Filterable {
                if ($checkPassed === FALSE) {
                        // Throw an exception
                        throw new FilterChainException($this, self::EXCEPTION_FILTER_CHAIN_INTERCEPTED);
-               } // END - if
+               }
        }
 
 }
index 245447f0e610f337c9bdfc5090be5ec87dda3e29..5bb3d351838488f354011184fd4c1240558f0464 100644 (file)
@@ -122,7 +122,7 @@ class CrawlerTaskHandlerInitializerFilter extends BaseCrawlerFilter implements F
 
                        // And register it
                        $handlerInstance->registerTask('crawler_url_source_' . $stack, $taskInstance);
-               } // END - foreach
+               }
 
                // Put the task handler in registry
                GenericRegistry::getRegistry()->addInstance('task_handler', $handlerInstance);
index e295acd52c5761e5d1a23e4c012ce4ff1993edf0..8da315670e313353a1cf4b1e9eed8ceb05d8b0dc 100644 (file)
@@ -703,7 +703,7 @@ class ChunkHandler extends BaseHubHandler implements HandleableChunks, Registera
                        default: // Invalid step found
                                self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('CHUNK-HANDLER: Invalid step %d detected.', $this->finalPackageChunks['assemble_steps']));
                                break;
-               } // END - switch
+               }
 
                // Trace message
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CHUNK-HANDLER: EXIT!');
index a52d142f3aaadf2940010e2a416d731f8ae11950..b2701b261779c15ebbcd25ce44f86cc0674b42ec 100644 (file)
@@ -118,7 +118,7 @@ class NodeMessageAnnouncementHandler extends BaseMessageHandler implements Handl
                         * announce his node to a non-bootstrap and non-master node.
                         */
                        throw new AnnouncementNotAcceptedException(array($this, $nodeInstance, $messageInstance), BaseHubSystem::EXCEPTION_ANNOUNCEMENT_NOT_ACCEPTED);
-               } // END - if
+               }
 
                // Register the announcing node with this node
                $this->registerNodeByMessageInstance($messageInstance);
@@ -146,7 +146,7 @@ class NodeMessageAnnouncementHandler extends BaseMessageHandler implements Handl
                        // Add it
                        /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('ANNOUNCEMENT-HANDLER: Adding messageData[' . $key . ']=' . $messageData[$key] . ' ...');
                        $dataSetInstance->addCriteria($key, $messageData[$key]);
-               } // END - foreach
+               }
        }
 
 }
index 716c099f44f5c6339ae3149d4fbc7c8059e28acf..e016b630373cd3b83f55a3a1cea5448e5eca6ef9 100644 (file)
@@ -116,7 +116,7 @@ class NodeMessageAnnouncementAnswerHandler extends BaseMessageHandler implements
                         * announcement answer messages.
                         */
                        throw new NoAnnouncementAttemptedException(array($this, $nodeInstance, $messageInstance), self::EXCEPTION_ANNOUNCEMENT_NOT_ATTEMPTED);
-               } // END - if
+               }
 
                // Register the announcing node with this node
                $this->registerNodeByMessageInstance($messageInstance);
@@ -146,7 +146,7 @@ class NodeMessageAnnouncementAnswerHandler extends BaseMessageHandler implements
                         * database layer.
                         */
                        $dataSetInstance->addCriteria(str_replace('my-', '', $key), $messageData[$key]);
-               } // END - foreach
+               }
        }
 
 }
index fcb3afda47c40ef8c1bd28d0d1fb29619e32d58b..8925d34d52ead2652a4acfff8e58e4555d8f6da1 100644 (file)
@@ -114,7 +114,7 @@ class NodeMessageDhtBootstrapAnswerHandler extends BaseMessageHandler implements
                         * announcement answer messages.
                         */
                        throw new NoDhtBootstrapAttemptedException(array($this, $dhtInstance, $messageInstance), self::EXCEPTION_DHT_BOOTSTRAP_NOT_ATTEMPTED);
-               } // END - if
+               }
 
                // Unfinished
                $this->partialStub('UNHANDLED: messageInstance=' . print_r($messageInstance, TRUE));
@@ -141,7 +141,7 @@ class NodeMessageDhtBootstrapAnswerHandler extends BaseMessageHandler implements
                         * database layer.
                         */
                        $dataSetInstance->addCriteria(str_replace('my-', '', $key), $messageData[$key]);
-               } // END - foreach
+               }
        }
 
 }
index d3ab2e9b607d07ee450a04701523b6f56e1cfb54..0e51a128f30260c32a014e7a9c455274726c3cd4 100644 (file)
@@ -105,7 +105,7 @@ class NodeMessageRequestNodeListAnswerHandler extends BaseMessageHandler impleme
                         * request-node-list answer messages.
                         */
                        throw new NoRequestNodeListAttemptedException(array($this, $nodeInstance, $messageInstance), self::EXCEPTION_ANNOUNCEMENT_NOT_ATTEMPTED);
-               } // END - if
+               }
 
                // Register the announcing node with this node
                $this->registerNodeByMessageInstance($messageInstance);
@@ -141,7 +141,7 @@ class NodeMessageRequestNodeListAnswerHandler extends BaseMessageHandler impleme
                         * database layer.
                         */
                        $dataSetInstance->addCriteria(str_replace('my-', '', $key), $messageData[$key]);
-               } // END - foreach
+               }
        }
 
 }
index be36b09f6ee238ecdd897cf0fb5158d128c12aa4..668171f162da003bcd9a74deb70f80cfeea4d453 100644 (file)
@@ -60,7 +60,7 @@ abstract class BaseMessageHandler extends BaseDataHandler {
                if ($this->getLastException() instanceof FrameworkException) {
                        // "Determine" the right status code (may differ from exception to exception)
                        $this->debugInstance(sprintf('[%s:%d]: lastException=%s,message=%s is unfinished.', __METHOD__, __LINE__, $this->getLastException()->__toString(), $this->getLastException()->getMessage()));
-               } // END - if
+               }
 
                // Return the status code
                return $statusCode;
index 6701a57ffd2224e3624b44a73b8ec638f913cbee..31024504fed3b1678cd9516a2080b5a89df89535 100644 (file)
@@ -109,7 +109,7 @@ class NodeMessageDhtBootstrapHandler extends BaseMessageHandler implements Handl
                         * This node is not accepting DHT bootstrap requests.
                         */
                        throw new DhtBootstrapNotAcceptedException(array($this, $messageInstance), self::EXCEPTION_DHT_BOOTSTRAP_NOT_ACCEPTED);
-               } // END - if
+               }
 
                // Register the DHT bootstrap requesting node with this node
                $this->registerNodeByMessageInstance($messageInstance);
@@ -136,7 +136,7 @@ class NodeMessageDhtBootstrapHandler extends BaseMessageHandler implements Handl
 
                        // Add it
                        $dataSetInstance->addCriteria($key, $messageData[$key]);
-               } // END - foreach
+               }
        }
 
 }
index ab644e7add936a05d3f6679c2db5892971666d1f..55aea718fb9fe23e43c727dfb2e4ac0b047c8935 100644 (file)
@@ -97,7 +97,7 @@ class NodeMessageRequestNodeListHandler extends BaseMessageHandler implements Ha
                         * exception to abort any further processing.
                         */
                        throw new RequestNotAcceptedException(array($this, $nodeInstance, $messageInstance), self::EXCEPTION_REQUEST_NOT_ACCEPTED);
-               } // END - if
+               }
 
                // Register the announcing node with this node
                $this->registerNodeByMessageInstance($messageInstance);
@@ -124,7 +124,7 @@ class NodeMessageRequestNodeListHandler extends BaseMessageHandler implements Ha
 
                        // Add it
                        $dataSetInstance->addCriteria($key, $messageData[$key]);
-               } // END - foreach
+               }
        }
 
 }
index cc1ce6d1b9d67e37edbea7d27f054ff6185dfeb9..687b1d0d85190b49c15e9be7402dc059f15ed403 100644 (file)
@@ -1102,10 +1102,8 @@ class NetworkPackageHandler extends BaseHubHandler implements Deliverable, Recei
         * @return      void
         */
        public function sendEncodedData () {
-               // Debug message
-               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE-HANDLER: CALLED!');
-
                // Make sure there is pending encoded data
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE-HANDLER: CALLED!');
                assert($this->isEncodedDataPending());
 
                // Pop current data from stack
@@ -1123,19 +1121,15 @@ class NetworkPackageHandler extends BaseHubHandler implements Deliverable, Recei
                $socketInstance = $encodedDataArray[self::RAW_INDEX_SOCKET_INSTANCE];
                $encodedDataArray[self::RAW_INDEX_SOCKET_INSTANCE] = NULL;
 
-               // Trace message
-               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NETWORK-PACKAGE-HANDLER: Calling socketInstance->writeBufferToSocketByArray(%d,%d) ...', count($encodedDataArray), $sentBytes));
-
                // And deliver it
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NETWORK-PACKAGE-HANDLER: Calling socketInstance->writeBufferToSocketByArray(%d,%d) ...', count($encodedDataArray), $sentBytes));
                if (!$socketInstance->writeBufferToSocketByArray($encodedDataArray, $sentBytes)) {
                        // Something bad happened while writing to socket
                        $socketInstance->handleSocketError(__METHOD__, __LINE__);
                }
 
-               // Debug message
-               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NETWORK-PACKAGE-HANDLER: sentBytes[%s]=%d', gettype($sentBytes), $sentBytes));
-
                // If there was an error, don't continue here
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NETWORK-PACKAGE-HANDLER: sentBytes[%s]=%d', gettype($sentBytes), $sentBytes));
                if (($sentBytes === 0) && (strlen($encodedDataArray[self::RAW_INDEX_ENCODED_DATA]) > 0)) {
                        // Nothing sent means all data has been sent
                        /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE-HANDLER: All sent! (LINE=' . __LINE__ . ')');
@@ -1149,13 +1143,11 @@ class NetworkPackageHandler extends BaseHubHandler implements Deliverable, Recei
                // Set it back
                $encodedDataArray[self::RAW_INDEX_SOCKET_INSTANCE] = $socketInstance;
 
-               // Debug message
-               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE-HANDLER: Pushing raw data back to stacker, as still some data is pending delivery.');
-
                // Push array back in stack
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE-HANDLER: Pushing raw data back to stacker, as still some data is pending delivery.');
                $this->getStackInstance()->pushNamed(self::STACKER_NAME_OUTGOING_STREAM, $encodedDataArray);
 
-               // Debug message
+               // Trace message
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE-HANDLER: EXIT!');
        }
 
@@ -1169,16 +1161,12 @@ class NetworkPackageHandler extends BaseHubHandler implements Deliverable, Recei
         * @return      $isPending      Whether decoded raw data is pending
         */
        private function isRawDataPending () {
-               // Trace message
-               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE-HANDLER: CALLED!');
-
                // Just return whether the stack is not empty
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE-HANDLER: CALLED!');
                $isPending = (!$this->getStackInstance()->isStackEmpty(self::STACKER_NAME_DECODED_INCOMING));
 
-               // Trace message
-               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NETWORK-PACKAGE-HANDLER: isPending=%d - EXIT!', intval($isPending)));
-
                // Return the status
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NETWORK-PACKAGE-HANDLER: isPending=%d - EXIT!', intval($isPending)));
                return $isPending;
        }
 
@@ -1188,19 +1176,15 @@ class NetworkPackageHandler extends BaseHubHandler implements Deliverable, Recei
         * @return      $hasArrived             Whether new raw package data has arrived for processing
         */
        public function isNewRawDataPending () {
-               // Trace message
-               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NETWORK-PACKAGE-HANDLER: Calling this->getListenerPoolInstance()->accept(%s) ... - CALLED!', $this->getVisitorInstance()));
-
                // Visit the pool. This monitors the pool for incoming raw data.
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NETWORK-PACKAGE-HANDLER: Calling this->getListenerPoolInstance()->accept(%s) ... - CALLED!', $this->getVisitorInstance()));
                $this->getListenerPoolInstance()->accept($this->getVisitorInstance());
 
                // Check for new data arrival
                $hasArrived = $this->isRawDataPending();
 
-               // Trace message
-               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NETWORK-PACKAGE-HANDLER: hasArrived=%d - EXIT!', intval($hasArrived)));
-
                // Return the status
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NETWORK-PACKAGE-HANDLER: hasArrived=%d - EXIT!', intval($hasArrived)));
                return $hasArrived;
        }
 
index 2fa8598c72938b50fccdb1b61a1c53bc67b14041..924f060f38e2a584c32366d20ce906fddfc43580 100644 (file)
@@ -103,7 +103,7 @@ abstract class BaseIpV4ProtocolHandler extends BaseProtocolHandler {
 
                        // Set port
                        $this->setPort($locatorInstance->getUnlPort());
-               } // END - if
+               }
 
                // Return result
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('IPV4-PROTOCOL-HANDLER: isValid=%d - EXIT!', intval($isValid)));
index a979a0344941053ff429d96a5dc6594907852fc8..9bf0af4e6f142c3c3bc6e7ceeaab0d81cbc6ce4d 100644 (file)
@@ -127,7 +127,7 @@ class TcpRawDataHandler extends BaseRawDataHandler implements Networkable {
                                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('TCP-RAW-DATA-HANDLER: Adding %d(%s) bytes to stacker ...', strlen($rawData), $rawData));
                                $this->addRawDataToStacker($rawData);
                        }
-               } // END - while
+               }
 
                // Trace message
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TCP-RAW-DATA-HANDLER: EXIT!');
index 1609fe028b71839f26fe83e37ef40e06e6769be2..bd9f5df5b970090ef0a08005ae00f87712c9c6b6 100644 (file)
@@ -101,7 +101,7 @@ class TcpConnectionHelper extends BaseIpV4ConnectionHelper implements Connection
                                if (strpos($packageInstance->getRecipientUnl(), ':') === FALSE) {
                                        // No ip:port!
                                        $helperInstance->debugInstance(sprintf('[%s:%d]: recipient=%s does not contain ":". Please fix this.', __METHOD__, __LINE__, $packageInstance->getRecipientUnl()));
-                               } // END - if
+                               }
 
                                // "explode" the ip:port, so index 1 will be the port number
                                // @TODO Rewrite this test for UNLs
index 31f46d3e3c89e9dd2cb338b9342423c639091761..e8da7f9f8a4d46b69216333d3fef7294a01a0aa1 100644 (file)
@@ -208,7 +208,7 @@ class ConnectionInfo extends BaseInfo implements ShareableInfo, Registerable {
                if (!$socketInstance->determineSocketPeerName($socketAddress, $socketPort)) {
                        // Did not work
                        throw new InvalidSocketException(array($this, $socketInstance->getSocketResource()), self::EXCEPTION_INVALID_SOCKET);
-               } // END - if
+               }
 
                // Fill the generic array with several data from the listener:
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('CONNECTION-INFO: socketAddress=%s,socketPort=%d', $socketAddress, $socketPort));
index 82d4465869b6274243d204303217b924da231573..c4f17aef2b8527db3e8f3ad15eb2cbee3c40813a 100644 (file)
@@ -80,7 +80,7 @@ class NetworkListenIterator extends BaseIterator implements Iterator {
                if (!$this->valid()) {
                        // Throw an exception here
                        throw new IndexOutOfBoundsException($this->key(), self::EXCEPTION_INDEX_OUT_OF_BOUNDS);
-               } // END - if
+               }
 
                // Now get the entry
                $current = $this->getListInstance()->getEntry($this->key());
index 168a9e4f8dfc0231f0f31f3664e816e75656752c..4466c7dd097544dc58897576793830ffd73a8607 100644 (file)
@@ -80,7 +80,7 @@ class HandlerPoolIterator extends BaseIterator implements Iterator {
                if (!$this->valid()) {
                        // Throw an exception here
                        throw new IndexOutOfBoundsException($this->key(), self::EXCEPTION_INDEX_OUT_OF_BOUNDS);
-               } // END - if
+               }
 
                // Now get the entry
                $current = $this->getListInstance()->getEntry($this->key());
index e08bd3ab7a7139b9d3fd800a1c4d84a8092275a6..f8784f2116276ba2d89c159ad35f0349ed100bd7 100644 (file)
@@ -81,7 +81,7 @@ class MonitorPoolIterator extends BaseIterator implements Iterator, Registerable
                if (!$this->valid()) {
                        // Throw an exception here
                        throw new IndexOutOfBoundsException($this->key(), self::EXCEPTION_INDEX_OUT_OF_BOUNDS);
-               } // END - if
+               }
 
                // Now get the entry
                $current = $this->getListInstance()->getEntry($this->key());
index 4613ed2d711d359470024affaac1071e4d824c35..9300f66ae6e43c3f12f8e68cbf917c64255f57b5 100644 (file)
@@ -78,7 +78,7 @@ class ShutdownPoolIterator extends BaseIterator implements Iterator {
                if (!$this->valid()) {
                        // Throw an exception here
                        throw new IndexOutOfBoundsException($this->key(), self::EXCEPTION_INDEX_OUT_OF_BOUNDS);
-               } // END - if
+               }
 
                // Now get the entry
                $current = $this->getListInstance()->getEntry($this->key());
index fd15e7a01a285d63079d414f8ca30497d6b236dd..0957ffddd2389a82e88dbf132672550ed4fa2108 100644 (file)
@@ -81,7 +81,7 @@ class TaskPoolIterator extends BaseIterator implements Iterator, Registerable {
                if (!$this->valid()) {
                        // Throw an exception here
                        throw new IndexOutOfBoundsException($this->key(), self::EXCEPTION_INDEX_OUT_OF_BOUNDS);
-               } // END - if
+               }
 
                // Now get the entry
                $current = $this->getListInstance()->getEntry($this->key());
index c556b63fa4087b4314ec7ecee9121b1cbe942445..68c0fc45e199963779de3b4057207e8684de7d2c 100644 (file)
@@ -233,7 +233,7 @@ abstract class BaseListener extends BaseHubSystem implements Visitable {
                if ($this->isServerSocketRegistered($socketInstance)) {
                        // Already registered
                        throw new SocketAlreadyRegisteredException(array($this, $socketInstance->getSocketResource()), self::EXCEPTION_SOCKET_ALREADY_REGISTERED);
-               } // END - if
+               }
 
                // Get a connection info instance
                $infoInstance = ConnectionInfoFactory::createConnectionInfoInstance($this->getProtocolName(), StorableSocket::CONNECTION_TYPE_SERVER);
@@ -242,7 +242,7 @@ abstract class BaseListener extends BaseHubSystem implements Visitable {
                if (!($infoInstance instanceof ShareableInfo)) {
                        // Should not happen
                        throw new LogicException(sprintf('infoInstance[]=%s does not implement ShareableInfo', gettype($infoInstance)));
-               } // END - if
+               }
 
                // Will the info instance with listener data
                $infoInstance->fillWithListenerInformation($this);
@@ -307,7 +307,7 @@ abstract class BaseListener extends BaseHubSystem implements Visitable {
                if ($this->getPoolInstance() instanceof Poolable) {
                        // Visit pool instance
                        $this->getPoolInstance()->accept($visitorInstance);
-               } // END - if
+               }
 
                // Debug message
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(strtoupper($this->getProtocolName()) . '-LISTENER: ' . $visitorInstance->__toString() . ' has visited ' . $this->__toString() . ' - EXIT!');
@@ -337,7 +337,7 @@ abstract class BaseListener extends BaseHubSystem implements Visitable {
                if (is_null($iteratorInstance)) {
                        // Throw NPE
                        throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER);
-               } // END - if
+               }
 
                // Is it valid?
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-LISTENER: iteratorInstance->valid()=%d', strtoupper($this->getProtocolName()), intval($iteratorInstance->valid())));
@@ -345,7 +345,7 @@ abstract class BaseListener extends BaseHubSystem implements Visitable {
                        // Then rewind it
                        /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-LISTENER: Rewinding iterator ...', strtoupper($this->getProtocolName())));
                        $iteratorInstance->rewind();
-               } // END - if
+               }
 
                // Get current instance
                $socketInstance = $iteratorInstance->current();
@@ -400,7 +400,7 @@ abstract class BaseListener extends BaseHubSystem implements Visitable {
                        // Nothing has changed on the listener
                        /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-LISTENER: No new connection on listener ... - EXIT!', strtoupper($this->getProtocolName())));
                        return;
-               } // END - if
+               }
 
                // Get a connection info instance
                $infoInstance = ConnectionInfoFactory::createConnectionInfoInstance($this->getProtocolName(), StorableSocket::CONNECTION_TYPE_INCOMING);
@@ -410,7 +410,7 @@ abstract class BaseListener extends BaseHubSystem implements Visitable {
                if (!($infoInstance instanceof ShareableInfo)) {
                        // Should not happen
                        throw new LogicException(sprintf('infoInstance[]=%s does not implement ShareableInfo', gettype($infoInstance)));
-               } // END - if
+               }
 
                // Will the info instance with listener data
                $infoInstance->fillWithSocketPeerInformation($socketInstance);
@@ -423,7 +423,7 @@ abstract class BaseListener extends BaseHubSystem implements Visitable {
                if (!$socketInstance->determineSocketPeerName($peerAddress, $peerPort)) {
                        // Handle this socket error
                        $socketInstance->handleSocketError(__METHOD__, __LINE__);
-               } // END - if
+               }
 
                // Set all required data
                //* DEBUG-DIE: */ $infoInstance->debugInstance();
index 2b942b67dd031a6955acc48385104adbfa68164a..8ae45606f76816a580d5f93b31c2db4ac50d6f2b 100644 (file)
@@ -186,7 +186,7 @@ abstract class BaseListenerDecorator extends BaseDecorator implements Visitable
                        // No data is pending so skip further code silently
                        /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(strtoupper($this->getProtocolName()) . '-LISTENER-DECORATOR: No data pending on handlerInstance=' . $handlerInstance->__toString() . ' - EXIT!');
                        return;
-               } // END - if
+               }
 
                // Get receiver (network package) instance
                $receiverInstance = NetworkPackageHandlerFactory::createNetworkPackageHandlerInstance();
index 4a97d89eda8b2088ce54166d21002dc69d48d19b..1b06630c6bdbac232c797c243a4face07e9136c5 100644 (file)
@@ -135,7 +135,7 @@ class SocketFileListener extends BaseListener implements Listenable {
 
                        // Is already different protocol
                        return FALSE;
-               } // END - if
+               }
 
                // Debugging
                /* DEBUG-DIE: */ die(__METHOD__.':packageInstance='.print_r($packageInstance, TRUE));
index 532498afb7712926eb225d00df131bc4943a15f0..ccc76a0897848686b5f7d3de3e7599898dc13b70 100644 (file)
@@ -107,7 +107,7 @@ class ClientTcpListenerDecorator extends BaseListenerDecorator implements Listen
 
                        // Is already different protocol
                        return FALSE;
-               } // END - if
+               }
 
                // Debugging
                /* DEBUG-DIE: */ die(__METHOD__ . ':packageInstance=' . print_r($packageInstance, TRUE));
index 66dab9fad0f0cb16816c9bdca4ea6201352bdd5c..26c57679f7af5bc450032bcd38271e718ccfb1c3 100644 (file)
@@ -107,7 +107,7 @@ class HubTcpListenerDecorator extends BaseListenerDecorator implements Listenabl
 
                        // Is already different protocol
                        return FALSE;
-               } // END - if
+               }
 
                // Debugging
                //* DEBUG-DIE: */ die(__METHOD__ . ':packageInstance=' . print_r($packageInstance, TRUE));
index 028738c22fb8523627148cb2aadb0213075ed8f1..3a87327e7c08bb3424605076c035b32ce98c221e 100644 (file)
@@ -107,7 +107,7 @@ class ClientUdpListenerDecorator extends BaseListenerDecorator implements Listen
 
                        // Is already different protocol
                        return FALSE;
-               } // END - if
+               }
 
                // Debugging
                /* DEBUG-DIE: */ die(__METHOD__ . ':packageInstance=' . print_r($packageInstance, TRUE));
index d67923d708eed09379ca60696b60889c76201948..71a739c8fb3d8fb77d7928a2e1a2b6b2c881926c 100644 (file)
@@ -107,7 +107,7 @@ class HubUdpListenerDecorator extends BaseListenerDecorator implements Listenabl
 
                        // Is already different protocol
                        return FALSE;
-               } // END - if
+               }
 
                // Debugging
                /* DEBUG-DIE: */ die(__METHOD__ . ':packageInstance=' . print_r($packageInstance, TRUE));
index b94120832755591f2132baf42b39e1d10c0148b1..9659b55d3af5786715391560a73665e0c8befaef 100644 (file)
@@ -137,7 +137,7 @@ class UniversalNodeLocator extends BaseHubSystem implements LocateableNode, Regi
                $this->unlData = [];
 
                // Copy all found entries
-               foreach (array(
+               foreach ([
                        LocateableNode::UNL_PART_PROTOCOL,
                        LocateableNode::UNL_PART_ADDRESS,
                        LocateableNode::UNL_PART_EXTRA,
@@ -146,7 +146,7 @@ class UniversalNodeLocator extends BaseHubSystem implements LocateableNode, Regi
                        NodeInformationDatabaseFrontend::DB_COLUMN_PRIVATE_KEY_HASH,
                        NodeInformationDatabaseFrontend::DB_COLUMN_NODE_MODE,
                        NodeInformationDatabaseFrontend::DB_COLUMN_INTERNAL_UNL,
-                       NodeInformationDatabaseFrontend::DB_COLUMN_EXTERNAL_UNL) as $key) {
+                       NodeInformationDatabaseFrontend::DB_COLUMN_EXTERNAL_UNL] as $key) {
                                // Init entry
                                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('UNIVERSAL-NODE-LOCATOR: key=%s', $key));
                                $this->unlData[$key] = NULL;
index 79316bddd0890de68954ebd42274d78e42ea7652..dcc7f61c4cbaaeecc5ec4c1a77d7d6bd360ede8e 100644 (file)
@@ -92,7 +92,7 @@ class HubCoinMiner extends BaseHubMiner implements MinerHelper, Registerable {
 
                        // ... and finally queue it to the in-buffer queue
                        $this->queueUnitInstanceToInBuffer($unitInstance);
-               } // END - for
+               }
        }
 
        /**
@@ -106,7 +106,7 @@ class HubCoinMiner extends BaseHubMiner implements MinerHelper, Registerable {
                if ($this->getStateInstance()->isMinerStateVirgin()) {
                        // We can silently skip here, until the generation is finished
                        return;
-               } // END - if
+               }
 
                // @TODO Implement this method
                $this->partialStub('Please implement this method.');
index efc25d476af8ccb43c009d05a4c8bed4d8361698..95de4f9417abe15bda20761e0d3ea6d5246743f5 100644 (file)
@@ -218,8 +218,8 @@ abstract class BaseHubMiner extends BaseHubSystem implements Updateable {
                        if ((!$this->isInBufferQueueFilled()) && (FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('miner_test_units_enabled') == 'Y')) {
                                // Then fill the in-buffer with (one) test-unit(s)
                                $this->fillInBufferQueueWithTestUnits();
-                       } // END - if
-               } // END - if
+                       }
+               }
        }
 
        /**
@@ -255,7 +255,7 @@ abstract class BaseHubMiner extends BaseHubSystem implements Updateable {
                if (count($this->producersInitialized) == self::MAX_PRODUCERS) {
                        // Change it to 'booting'
                        MinerStateFactory::createMinerStateInstanceByName('booting');
-               } // END - if
+               }
        }
 
 }
index f5662d608e83df45308b03e7c5662f5f05e670ab..36be091c19a60bb9217e8630a997e389298ba112 100644 (file)
@@ -234,7 +234,7 @@ class PackageAssembler extends BaseHubSystem implements Assembler, Registerable,
 
                                // Push it on stack
                                $this->getStackInstance()->pushNamed(self::STACKER_NAME_MULTIPLE_MESSAGE, $message);
-                       } // END - foreach
+                       }
 
                        // Clear pending data
                        $this->clearPendingData();
@@ -263,7 +263,7 @@ class PackageAssembler extends BaseHubSystem implements Assembler, Registerable,
                if (substr($packageInstance->getRawData(), -1, 1) == PackageFragmenter::CHUNK_SEPARATOR) {
                        // Remove it
                        $packageInstance->setRawData(substr($packageInstance->getRawData(), 0, -1));
-               } // END - if
+               }
 
                /*
                 * "explode" the string from 'raw_data' with chunk separator to get an
@@ -281,11 +281,17 @@ class PackageAssembler extends BaseHubSystem implements Assembler, Registerable,
         * Handles multiple messages.
         *
         * @return      void
+        * @throws      BadMethodCallException  If some bad method invocation has happened
         */
        public function handleMultipleMessages () {
-               // Assert on condition
-               assert($this->ifMultipleMessagesPending());
-               assert($this->isPendingDataEmpty());
+               // Validate conditions
+               if (!$this->ifMultipleMessagesPending()) {
+                       // Opps?
+                       throw new BadMethodCallException('No multiple messages are pending but method called');
+               } elseif (!$this->isPendingDataEmpty()) {
+                       // Pending data is not empty but invoked
+                       throw new BadMethodCallException(sprintf('this->pendingData()=%d still filled but method called', strlen($this->pendingData)));
+               }
 
                // "Pop" next entry from stack and set it as new pending data
                $this->pendingData = $this->getStackInstance()->popNamed(self::STACKER_NAME_MULTIPLE_MESSAGE);
index ccd8c8a52390671424676361b3607030a4f35232..cf16ecd985dee988f5162274ce87f5198fe64993 100644 (file)
@@ -400,7 +400,7 @@ class PackageFragmenter extends BaseHubSystem implements Fragmentable, Registera
 
                        // Add the chunk to the propper array and do all the stuff there
                        $this->addChunkData($finalHash, $chunkData);
-               } // END - for
+               }
 
                // Debug output
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-FRAGMENTER: Raw data of ' . strlen($rawData) . ' bytes has been fragmented into ' . count($this->chunks[$finalHash]) . ' chunk(s).');
@@ -452,7 +452,7 @@ class PackageFragmenter extends BaseHubSystem implements Fragmentable, Registera
                                // Then initialize it
                                $this->chunks[$finalHash]      = [];
                                $this->chunkHashes[$finalHash] = [];
-                       } // END - if
+                       }
 
                        // Add both
                        array_push($this->chunks[$finalHash]     , $rawData);
index 6bb95eadfb3889066ad76c8a1119bf6bec11035c..c2ba9855fe41e3bf09a4ae02201125a8c2b11771 100644 (file)
@@ -80,7 +80,7 @@ abstract class BasePool extends BaseHubSystem implements Poolable, Visitable {
                if (!$this->getPoolEntriesInstance()->isGroupSet($group)) {
                        // Create the missing pool group
                        $this->getPoolEntriesInstance()->addGroup($group);
-               } // END - if
+               }
 
                // Add it to given pool group
                $this->getPoolEntriesInstance()->addInstance($group, $poolName, $visitableInstance);
@@ -154,7 +154,7 @@ abstract class BasePool extends BaseHubSystem implements Poolable, Visitable {
 
                        // Rewind it
                        $iteratorInstance->rewind();
-               } // END - if
+               }
 
                // Get current entry
                $poolEntry = $iteratorInstance->current();
index 7f36ee430417a64a53855832a9f9929f6b812496..21f7f9cd7f532fc774d5708a0b65e38664b5835f 100644 (file)
@@ -131,7 +131,7 @@ class CruncherKeyProducer extends BaseKeyProducer implements KeyProducer, Regist
 
                        // At last re-init the stack
                        $this->initOutgoingQueue();
-               } // END - if
+               }
 
                // Continue with next one
                $this->getIteratorInstance()->next();
index 7a745b36e93ebbeb82a77ca70bfee17c984f0c09..f5c82777bc50f5770c579e947dac800868eebedc 100644 (file)
@@ -90,7 +90,7 @@ class DirectRecipient extends BaseRecipient implements Recipient {
 
                        // Add it as recipient
                        $listInstance->addEntry('unl', $unlData);
-               } // END - foreach
+               }
 
                // Trace message
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DIRECT-RECIPIENT: EXIT!');
index 63c0b036655b3f8c91b697347d7310c137f062a9..60e7317a9e0418a6088c0636418a45630e8ef765 100644 (file)
@@ -79,7 +79,7 @@ class SelfRecipient extends BaseRecipient implements Recipient {
                if (!empty($unl)) {
                        // Add it to the list
                        $listInstance->addEntry('unl', $unl);
-               } // END - if
+               }
 
                // Trace message
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SELF-RECIPIENT: EXIT!');
index 38da98e9507c81ca66be49a0aa7b9d0d530da0cc..75d4831cb377c4039c3751c2af1ac39efbdfa6a1 100644 (file)
@@ -86,14 +86,14 @@ class UpperRecipient extends BaseRecipient implements Recipient {
                                // Then stop adding more
                                /* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('UPPER-RECIPIENT: Going to abort at maximum of ' . FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('package_recipient_max_count') . ' recipients!');
                                break;
-                       } // END - if
+                       }
 
                        // Debug message
                        /* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('UPPER-RECIPIENT: Adding node ' . print_r($unlData, TRUE) . ' as recipient.');
 
                        // Add the entry
                        $listInstance->addEntry('unl', $unlData);
-               } // END - foreach
+               }
 
                // Trace message
                /* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('UPPER-RECIPIENT: EXIT!');
index cf1169ca91ba5000752cfbb48871343b4a521e56..09b1516b38b4867b20d8f070479f4e1eec05f931 100644 (file)
@@ -54,7 +54,7 @@ class ObjectTypeRegistry extends BaseRegistry implements Register {
                if (is_null(self::$registryInstance)) {
                        // Not yet, so create one
                        self::$registryInstance = new ObjectTypeRegistry();
-               } // END - if
+               }
 
                // Return the instance
                return self::$registryInstance;
index b9750b317f361047e08eb05bbce75b22822df7d2..0818e710bccfa7eb12720a47af690402a4afa0bf 100644 (file)
@@ -95,7 +95,7 @@ class HubConsoleControllerResolver extends BaseControllerResolver implements Con
                if ((!is_object($controllerInstance)) || (!$controllerInstance instanceof Controller)) {
                        // This command has an invalid instance!
                        throw new InvalidControllerInstanceException(array($this, $controllerName), self::EXCEPTION_INVALID_CONTROLLER);
-               } // END - if
+               }
 
                // Set last controller
                $this->setResolvedInstance($controllerInstance);
index 71ad86c5e536480c90cc7b47dfa740e41dabf7f6..ba1f74aa480dde2b9f01911b412a06d76ccbda29 100644 (file)
@@ -95,7 +95,7 @@ class HubHtmlControllerResolver extends BaseControllerResolver implements Contro
                if ((!is_object($controllerInstance)) || (!$controllerInstance instanceof Controller)) {
                        // This command has an invalid instance!
                        throw new InvalidControllerInstanceException(array($this, $controllerName), self::EXCEPTION_INVALID_CONTROLLER);
-               } // END - if
+               }
 
                // Set last controller
                $this->setResolvedInstance($controllerInstance);
index 7b2a4fdb1d9ed51b824545372163732204d81239..d4df9a9410e43794f9022f90d6375068f3fb87a4 100644 (file)
@@ -127,8 +127,8 @@ class TcpProtocolResolver extends BaseProtocolResolver implements ProtocolResolv
                                case 'internal': // Internal IP
                                        $address = ConsoleTools::acquireSelfIPAddress();
                                        break;
-                       } // END - switch
-               } // END - if
+                       }
+               }
 
                // Put all together
                $unl = sprintf('%s://%s:%s',
index e1a4dc1b66663a53000daacb48f3daac63607f8a..7979bf5639bbbe277c018470ee73c65c3e92bdcd 100644 (file)
@@ -113,7 +113,7 @@ abstract class BaseStateResolver extends BaseResolver {
                if (!class_exists($this->getClassName())) {
                        // Throw an exception here
                        throw new UnresolveableStateException(array($this, $stateName), self::EXCEPTION_INVALID_STATE);
-               } // END - if
+               }
 
                // Initialize the state
                $stateInstance = ObjectFactory::createObjectByName(
@@ -141,7 +141,7 @@ abstract class BaseStateResolver extends BaseResolver {
                if (empty($stateName)) {
                        // Then thrown an exception here
                        throw new EmptyVariableException(array($this, 'stateName'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
-               } // END - if
+               }
 
                // Create class name
                $className = $this->statePrefix . StringUtils::convertToClassName($stateName) . 'State';
@@ -162,7 +162,7 @@ abstract class BaseStateResolver extends BaseResolver {
                                // All is tried, give it up here
                                throw new DefaultStateException($this, self::EXCEPTION_DEFAULT_STATE_GONE);
                        }
-               } // END - while
+               }
 
                // Return the result
                return $isValid;
index 0e5a93b6b464448198d9e559589723d7f5904909..8e427324bc677fec3ee92c58f1f9c2fac573ee00 100644 (file)
@@ -89,8 +89,8 @@ class PeerStateResolver extends BaseStateResolver implements StateResolver {
                        if (!$socketInstance->isValidSocket()) {
                                // Then abort here with an exception (may happen after socket_shutdown())
                                throw new InvalidSocketException(array($helperInstance, $socketInstance->getSocketResource()), self::EXCEPTION_INVALID_SOCKET);
-                       } // END - if
-               } // END - if
+                       }
+               }
 
                // Translate the error code to an own name
                $errorName = $socketInstance->translateLastSocketErrorCodeToName();
index e1aab13fae9d0f743e14ff2f0ade02ad18058b7a..60aaf6501e91419d02afb7cdfc0c16e14fb4f540 100644 (file)
@@ -170,7 +170,7 @@ class CrawlerUploadedListUrlSource extends BaseUrlSource implements UrlSource, R
 
                        // Rewind to start
                        $this->getDirectoryInstance()->getDirectoryIteratorInstance()->rewind();
-               } // END - if
+               }
 
                // Read next entry
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-UPLOADED-LIST-URL-SOURCE: this->csvFileImported=' . print_r($this->csvFileImported, TRUE));
@@ -182,7 +182,7 @@ class CrawlerUploadedListUrlSource extends BaseUrlSource implements UrlSource, R
                        // Skip further processing
                        /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-UPLOADED-LIST-URL-SOURCE: directoryEntry(' . strlen($directoryEntry) . ')=' . $directoryEntry . ' - SKIPPED!');
                        return FALSE;
-               } // END - if
+               }
 
                // Init SPL file instance
                $infoInstance = new SplFileInfo($this->csvFilePath . '/' . $directoryEntry);
@@ -342,7 +342,7 @@ class CrawlerUploadedListUrlSource extends BaseUrlSource implements UrlSource, R
 
                        // This file as been fully read, so don't push it back on stack.
                        return;
-               } // END - if
+               }
 
                // ...  with a fixed amount of elements, later enhancements may accept more
                assert(count($csvData) == self::CRAWL_ENTRY_SIZE);
index 8b1ca92060aa9c577fa4ca19626e21e187b5959a..7a9b31ba3fbe0ce43e36bdb89ba18cd538dbd331 100644 (file)
@@ -60,7 +60,7 @@ abstract class BaseCommunicatorState extends BaseState {
                if (!$this instanceof CommunicatorActiveState) {
                        // Throw the exception
                        throw new UnexpectedStateException($this, self::EXCEPTION_INVALID_STATE);
-               } // END - if
+               }
        }
 
        /**
index f5d1d653562c9186907c02514817c1981b5f9a80..4116debe189f4edcd84acd4f72c1cca4cf5724a4 100644 (file)
@@ -52,7 +52,7 @@ abstract class BaseCrawlerState extends BaseState {
                if (!$this instanceof CrawlerActiveState) {
                        // Throw the exception
                        throw new UnexpectedStateException($this, self::EXCEPTION_INVALID_STATE);
-               } // END - if
+               }
        }
 
 }
index 82c9969ac2fa2daa86581cc9b1cc17ffa5368bf3..c5d6951f44286652d64cd9b2b9a437e9330cd2e8 100644 (file)
@@ -52,7 +52,7 @@ abstract class BaseCruncherState extends BaseState {
                if (!$this instanceof CruncherActiveState) {
                        // Throw the exception
                        throw new UnexpectedStateException($this, self::EXCEPTION_INVALID_STATE);
-               } // END - if
+               }
        }
 
        /**
index ed338938e68ebde865d0a7598c4140b9714d50bb..8556de969120609431c67d09e9b5e2166c9f2918 100644 (file)
@@ -53,7 +53,7 @@ abstract class BaseDhtState extends BaseState {
                if ((!$this instanceof DhtVirginState) && (!$this instanceof DhtInitState)) {
                        // Throw the exception
                        throw new UnexpectedStateException($this, self::EXCEPTION_INVALID_STATE);
-               } // END - if
+               }
        }
 
        /**
index 7b3522aa5eada5a55e5ff557bb7db256a8cf88ab..36908ef47f3dee41f0756cfbaf8cce75220ccc0a 100644 (file)
@@ -71,7 +71,7 @@ class MinerBootingState extends BaseMinerState implements Stateable {
                if (isset($this->bootedProducer[$executorInstance->__toString()])) {
                        // Then silently skip this
                        return;
-               } // END - if
+               }
 
                // Debug message
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('MINER-STATE: Calling prepareBlockProduction() on ' . $executorInstance->__toString() . ' ...');
index 0a00fd948d8c55ab46d2861640e8d7de0e7462c1..c4a9bce876385e8a612f99755141a6b8f149adf0 100644 (file)
@@ -56,7 +56,7 @@ abstract class BaseMinerState extends BaseState {
                if (!$this instanceof MinerActiveState) {
                        // Throw the exception
                        throw new UnexpectedStateException($this, self::EXCEPTION_INVALID_STATE);
-               } // END - if
+               }
        }
 
        /**
@@ -71,7 +71,7 @@ abstract class BaseMinerState extends BaseState {
                if (!$this instanceof MinerInitState) {
                        // Throw the exception
                        throw new UnexpectedStateException($this, self::EXCEPTION_INVALID_STATE);
-               } // END - if
+               }
        }
 
        /**
@@ -86,7 +86,7 @@ abstract class BaseMinerState extends BaseState {
                if (!$this instanceof MinerBootingState) {
                        // Throw the exception
                        throw new UnexpectedStateException($this, self::EXCEPTION_INVALID_STATE);
-               } // END - if
+               }
        }
 
        /**
index 3cb4588d4bfbf2e96dae0ad3a18017b3da1612c3..32e116439c607df8f30dd6e7c42c45d9fd30ceae 100644 (file)
@@ -52,7 +52,7 @@ abstract class BaseNodeState extends BaseState {
                if (!$this instanceof NodeActiveState) {
                        // Throw the exception
                        throw new UnexpectedStateException($this, self::EXCEPTION_INVALID_STATE);
-               } // END - if
+               }
        }
 
        /**
@@ -67,7 +67,7 @@ abstract class BaseNodeState extends BaseState {
                if ((!$this instanceof NodeActiveState) && (!$this instanceof NodeAnnouncingState)) {
                        // Throw the exception
                        throw new UnexpectedStateException($this, self::EXCEPTION_INVALID_STATE);
-               } // END - if
+               }
        }
 
        /**
@@ -82,7 +82,7 @@ abstract class BaseNodeState extends BaseState {
                if ((!$this instanceof NodeActiveState) && (!$this instanceof NodeReachableState)) {
                        // Throw the exception
                        throw new UnexpectedStateException($this, self::EXCEPTION_INVALID_STATE);
-               } // END - if
+               }
        }
 
        /**
@@ -97,7 +97,7 @@ abstract class BaseNodeState extends BaseState {
                if (!$this instanceof NodeAnnouncementCompletedState) {
                        // Throw the exception
                        throw new UnexpectedStateException($this, self::EXCEPTION_INVALID_STATE);
-               } // END - if
+               }
        }
 
 }
index 6c608f265e78f42de6803c0c00ee4693a836b8d4..8b4e6fe21c2b70e3e83f684bbd35827193a9451e 100644 (file)
@@ -52,7 +52,7 @@ abstract class BasePeerState extends BaseState {
                if (!$this->isPeerStateConnected()) {
                        // Throw the exception
                        throw new UnexpectedStateException($this, self::EXCEPTION_INVALID_STATE);
-               } // END - if
+               }
        }
 
        /**
index e4f8546de0afb72654a195edce7002fddd31bc8d..c15bd1174d1b708dc35a6db01238dd7f80feaacc 100644 (file)
@@ -10,6 +10,9 @@ use Org\Shipsimu\Hub\Handler\Network\RawData\HandleableRawData;
 use Org\Mxchange\CoreFramework\Stream\BaseStream;
 use Org\Mxchange\CoreFramework\Stream\Input\InputStream;
 
+// Import SPL stuff
+use \InvalidArgumentException;
+
 /**
  * A class for handling incoming (encoded) raw data with start and end markers.
  * The "stream" is being verified by its length (if modulo 4 of it is always
@@ -67,25 +70,27 @@ class RawDataInputStream extends BaseStream implements InputStream {
         * @param       $data   The data (string mostly) to "stream"
         * @return      $data   The data (string mostly) to "stream"
         * @todo        Do we need to do something more here?
+        * @throws      InvalidArgumentException        If $data is empty or does not contain start/end marker
         * @throws      Base64EncodingModuloException   If the data's length modulo 4 is not zero
         * @throws      Base64EncodingBadException              If the data contains characters which are not in the "alphabet" of BASE64 messages.
         * @throws      MultipleMessageSentException    If the sender has sent two messages and both end up here
         */
        public function streamData (string $data) {
-               // Debug message
-               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('RAW-INPUT-STREAM: data(' . strlen($data) . ')=' . $data . ' - CALLED!');
-
                // Do we have start and end marker again?
-               assert($this->ifStartEndMarkersSet($data));
-
-               // Count of start and end markers must be the same
-               assert(substr_count($data, HandleableRawData::STREAM_START_MARKER) == substr_count($data, HandleableRawData::STREAM_END_MARKER));
-
-               // Check if more than two start markers exist and if so, split it.
-               if (substr_count($data, HandleableRawData::STREAM_START_MARKER) > 1) {
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('RAW-INPUT-STREAM: data(%d)=%s - CALLED!', strlen($data), $data));
+               if (empty($data)) {
+                       // Throw exception
+                       throw new InvalidArgumentException('Parameter "data" is empty');
+               } elseif (!$this->ifStartEndMarkersSet($data)) {
+                       // No start/end marker set
+                       throw new InvalidArgumentException(sprintf('data=%s has no start/end marker set', $data));
+               } elseif (substr_count($data, HandleableRawData::STREAM_START_MARKER) !== substr_count($data, HandleableRawData::STREAM_END_MARKER)) {
+                       // Start/end marker count not matching
+                       throw new InvalidArgumentException(sprintf('data=%s has different count of start/end markers set', $data));
+               } elseif (substr_count($data, HandleableRawData::STREAM_START_MARKER) > 1) {
                        // Please do it outside this method
                        throw new MultipleMessageSentException(array($this, $data), BaseHubSystem::EXCEPTION_MULTIPLE_MESSAGE_SENT);
-               } // END - if
+               }
 
                // Remove both
                $data = substr($data, strlen(HandleableRawData::STREAM_START_MARKER), -1 * strlen(HandleableRawData::STREAM_END_MARKER));
@@ -102,10 +107,8 @@ class RawDataInputStream extends BaseStream implements InputStream {
                        $data = base64_decode($data);
                }
 
-               // Debug message
-               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('RAW-INPUT-STREAM: Length of data is now ' . strlen($data) . ' Bytes.');
-
                // Return it
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('RAW-INPUT-STREAM: data(%d)=%s - EXIT!', strlen($data), $data));
                return $data;
        }
 
index ab8cf6a0077eab01ee161c8a03153eedb4df31b3..66145e11070c90e9b2d2f39a25d9e5d51011ce28 100644 (file)
@@ -161,12 +161,12 @@ class PackageTags extends BaseTag implements Tagable {
                        if ((!is_array($entry)) || (count($entry) == 0) || (!isset($entry[XmlObjectRegistryTemplateEngine::OBJECT_TYPE_DATA_PROTOCOL])) || (!isset($entry[XmlObjectRegistryTemplateEngine::OBJECT_TYPE_DATA_RECIPIENT_TYPE]))) {
                                // Invalid entry found
                                throw new InvalidTagException(array($this, $tag), self::EXCEPTION_INVALID_TAG);
-                       } // END - if
+                       }
 
                        // Now save the last discovered protocol/recipient type
                        $this->lastProtocol      = ProtocolHandlerFactory::createProtocolHandlerFromPackageInstance($packageInstance);
                        $this->lastRecipientType = $entry[XmlObjectRegistryTemplateEngine::OBJECT_TYPE_DATA_RECIPIENT_TYPE];
-               } // END - foreach
+               }
 
                // Trace message
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-TAGS: EXIT!');
index 82cb0b76b1d73b36abf4cb3111b4db51eca84c81..8ac6cd0118a69deb92de0f34e143b17d4be296ce 100644 (file)
@@ -93,7 +93,7 @@ class CrawlerUrlSourceFoundRssTask extends BaseUrlSourceTask implements Taskable
 
                        // And re-get it
                        $sourceInstance = $this->getUrlSourceInstance();
-               } // END - if
+               }
 
                // Debug message
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-URL-SOURCE-UPLOADED-LIST-TASK: sourceInstance[]=' . gettype($sourceInstance));
index 10d4a9b1f4a07ef1d789fefc7f34ee6744f11f51..e9571ba1a5254677b5b7ddd450b53102e7f53f85 100644 (file)
@@ -93,7 +93,7 @@ class CrawlerUrlSourceLocalStartTask extends BaseUrlSourceTask implements Taskab
 
                        // And re-get it
                        $sourceInstance = $this->getUrlSourceInstance();
-               } // END - if
+               }
 
                // Debug message
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-URL-SOURCE-UPLOADED-LIST-TASK: sourceInstance[]=' . gettype($sourceInstance));
index 33a36fd926ac4413da689b44443897bb59ef1b54..46a9e4a56d06df034542df0b5a503f38abfad15f 100644 (file)
@@ -93,7 +93,7 @@ class CrawlerUrlSourceRssStartTask extends BaseUrlSourceTask implements Taskable
 
                        // And re-get it
                        $sourceInstance = $this->getUrlSourceInstance();
-               } // END - if
+               }
 
                // Debug message
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-URL-SOURCE-UPLOADED-LIST-TASK: sourceInstance[]=' . gettype($sourceInstance));
index 0b5e9b7fac4161593235d45e276599e167cd5f0f..298177e962b5c08abd8167e4fe79200b6b5c0740 100644 (file)
@@ -93,7 +93,7 @@ class CrawlerUrlSourceUploadedListTask extends BaseUrlSourceTask implements Task
 
                        // And re-get it
                        $sourceInstance = $this->getUrlSourceInstance();
-               } // END - if
+               }
 
                // Debug message
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-URL-SOURCE-UPLOADED-LIST-TASK: sourceInstance[]=' . gettype($sourceInstance));
index 0e08c0d55c794fc81b7be88cd5545cc11f29b512..6973c27cdc11c54a9c2494afe78576d4b24c39ed 100644 (file)
@@ -83,7 +83,7 @@ class NodeDhtPublicationCheckTask extends BaseHubTask implements Taskable, Visit
                if (($dhtInstance->hasFullyBootstrapped()) && ($dhtInstance->hasUnpublishedEntries())) {
                        // Then initiate publishing them
                        $dhtInstance->initEntryPublication();
-               } // END - if
+               }
        }
 
        /**
index b4c65c4e7ac97bc27d13adba7571137c8074ede3..64cc9f70ad69ce8b1375f6807b7a0d306c7999d0 100644 (file)
@@ -83,7 +83,7 @@ class NodeDhtPublicationTask extends BaseHubTask implements Taskable, Visitable
                if ($dhtInstance->hasEntriesPendingPublication()) {
                        // Then publish next entry
                        $dhtInstance->publishEntry();
-               } // END - if
+               }
        }
 
        /**
index ffc0950d5a23eb6f6f51c8339c6339ce8c04bd0a..976d321811167c726cb93c05dad53e6dd8e1f0cd 100644 (file)
@@ -83,7 +83,7 @@ class NodeDhtQueryTask extends BaseHubTask implements Taskable, Visitable {
                if ($dhtInstance->ifInsertNodeDataPending()) {
                        // Then insert a single entry
                        $dhtInstance->insertSingleNodeData();
-               } // END - if
+               }
        }
 
        /**
index 5195d786fddabe75c8040982387fc63b2f2e6456..4acaa486fa28f3362b50ce4f50e524d7e1873689 100644 (file)
@@ -105,7 +105,7 @@ class XmlAnnouncementTemplateEngine extends BaseXmlTemplateEngine implements Com
                if (empty($characters)) {
                        // Then skip it silently
                        return;
-               } // END - if
+               }
 
                /*
                 * Assign the found characters to variable and use the last entry from
index 0a1ef4315bf5295e3ae36061565d8ae99b986b89..7c5aaecd4e09272e7105018f1c534259be14c839 100644 (file)
@@ -113,7 +113,7 @@ class XmlAnnouncementAnswerTemplateEngine extends BaseXmlAnswerTemplateEngine im
                if (empty($characters)) {
                        // Then skip it silently
                        return;
-               } // END - if
+               }
 
                /*
                 * Assign the found characters to variable and use the last entry from
index c155bc8da8106737f795eaa10d41ec8c8beebca1..075c518c4c3df3364de22833beecfbcbf8a4087e 100644 (file)
@@ -112,7 +112,7 @@ class XmlDhtBootstrapAnswerTemplateEngine extends BaseXmlAnswerTemplateEngine im
                if (empty($characters)) {
                        // Then skip it silently
                        return;
-               } // END - if
+               }
 
                /*
                 * Assign the found characters to variable and use the last entry from
index ae6307421bf662687e60e9d462a42753af5cdce8..f66e39a93cffef216e747f6619af31497479de11 100644 (file)
@@ -104,7 +104,7 @@ class XmlRequestNodeListAnswerTemplateEngine extends BaseXmlAnswerTemplateEngine
                if (empty($characters)) {
                        // Then skip it silently
                        return;
-               } // END - if
+               }
 
                /*
                 * Assign the found characters to variable and use the last entry from
index e6146ec865e06448de6e21e66f89bb7abbe24e5c..8dbf42184ab401e10b0998d093da7cda63a8978a 100644 (file)
@@ -95,7 +95,7 @@ class XmlSelfConnectTemplateEngine extends BaseXmlTemplateEngine implements Comp
                if (empty($characters)) {
                        // Then skip it silently
                        return;
-               } // END - if
+               }
 
                /*
                 * Assign the found characters to variable and use the last entry from
index c00113a78ea780108f6a198300ddf32e3315407e..9bb316812af184937ce3fd1fb0be279c05341804 100644 (file)
@@ -105,7 +105,7 @@ class XmlDhtPublishEntryTemplateEngine extends BaseXmlTemplateEngine implements
                if (empty($characters)) {
                        // Then skip it silently
                        return;
-               } // END - if
+               }
 
                /*
                 * Assign the found characters to variable and use the last entry from
index a79701face8a216839f6d8d6dbfee811e7c7319a..291612fcb7b6cfe5658452b37edd294558c10da9 100644 (file)
@@ -81,7 +81,7 @@ class XmlRequestNodeListEntryTemplateEngine extends BaseXmlTemplateEngine implem
                if (empty($characters)) {
                        // Then skip it silently
                        return;
-               } // END - if
+               }
 
                // Assign data with matching variable here
                parent::assignVariable($this->getStackInstance()->getNamed('node_request_node_list_entry'), $characters);
index 8ae96ea15158ebb040ae83ae68a57fa6e335480b..72b5c922861081d914703a9e6b6d3a13e2f94553 100644 (file)
@@ -109,7 +109,7 @@ class XmlObjectRegistryTemplateEngine extends BaseXmlTemplateEngine implements C
                if (empty($characters)) {
                        // Then skip it silently
                        return;
-               } // END - if
+               }
 
                // Get current XML node name as an array index
                $nodeName = $this->getStackInstance()->getNamed('node_object_registry');
@@ -119,7 +119,7 @@ class XmlObjectRegistryTemplateEngine extends BaseXmlTemplateEngine implements C
                if ($nodeName == self::OBJECT_TYPE_DATA_NAME) {
                        // Output debug message
                        /* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('XML-OBJECT-REGISTRY-TEMPLATE-ENGINE: Adding object type ' . $characters . ' to registry.');
-               } // END - if
+               }
 
                // Add it to the registry
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('XML-OBJECT-REGISTRY-TEMPLATE-ENGINE: EXIT!');
index 634a825b77493e469fe67685f74dbbbbd789a2d7..7ad7e13dde3d1547bd36b2c9b1d962a540dd50e2 100644 (file)
@@ -96,7 +96,7 @@ class XmlCruncherTestUnitTemplateEngine extends BaseXmlTemplateEngine implements
                if (empty($characters)) {
                        // Then skip it silently
                        return;
-               } // END - if
+               }
 
                // Assign the found characters to variable and use the last entry from
                // stack as the name
index 19ef10e986a8500815996db05ee007ee1b0e18cf..8d2c0eeb282f5925a60de707dd6c9fa984f058a1 100644 (file)
@@ -92,7 +92,7 @@ class XmlRequestNodeListTemplateEngine extends BaseXmlTemplateEngine implements
                if (empty($characters)) {
                        // Then skip it silently
                        return;
-               } // END - if
+               }
 
                // Assign data with matching variable here
                parent::assignVariable($this->getStackInstance()->getNamed('node_request_node_list'), $characters);
index a4f4985ecfef4134013dc3ab8877c058a507c2f2..3bb8cb43629b0e4d4ee0c1c27775bd57d680ba4d 100644 (file)
@@ -83,7 +83,7 @@ class HubTools extends BaseHubSystem {
                if (is_null(self::$selfInstance)) {
                        // Then set it
                        self::$selfInstance = new HubTools();
-               } // END - if
+               }
 
                // Return own instance
                return self::$selfInstance;
@@ -134,7 +134,7 @@ class HubTools extends BaseHubSystem {
                        if ($nodeInstance->getSessionId() == $sessionId) {
                                // Then get an instance of a LocateableNode class from it, assume TCP by default
                                $recipientUnl = self::determineOwnExternalAddress() . ':' . FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('node_listen_port');
-                       } // END - if
+                       }
                }
 
                // Return result
@@ -327,7 +327,7 @@ class HubTools extends BaseHubSystem {
                        // Make sure it is valid
                        // @TODO Find a better validation than empty()
                        assert(!empty($GLOBALS[__METHOD__]));
-               } // END - if
+               }
 
                // Return it
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('HUB-TOOLS: unl=' . $GLOBALS[__METHOD__] . ' - EXIT!');
@@ -355,7 +355,7 @@ class HubTools extends BaseHubSystem {
                        // Make sure it is valid
                        // @TODO Find a better validation than empty()
                        assert(!empty($GLOBALS[__METHOD__]));
-               } // END - if
+               }
 
                // Return it
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('HUB-TOOLS: unl=' . $GLOBALS[__METHOD__] . ' - EXIT!');
index 8051930bc16a5a6146546dc36950d6ba754c3deb..784a3910d0354483d20c99f94042f00a2af68a1a 100644 (file)
@@ -44,7 +44,7 @@ function hub_exception_handler ($exceptionInstance) {
                                // Convert arguments type into human-readable
                                foreach ($traceArray['args'] as $arg) {
                                        $argsString .= ', ' . gettype($arg);
-                               } // END - foreach
+                               }
                                $argsString = substr($argsString, 2);
                        }
 
@@ -67,7 +67,7 @@ Line   : %d\n",
                                basename($traceArray['file']),
                                $traceArray['line']
                        );
-               } // END - foreach
+               }
 
                // Construct the message
                $message = sprintf("--------------------------------------------------------------------------------
@@ -117,14 +117,14 @@ function hub_error_handler ($errno, $errstr, $errfile, $errline, array $errconte
 
        // Throw an exception here
        throw new FatalErrorException($message, BaseFrameworkSystem::EXCEPTION_FATAL_ERROR);
-} // END - function
+}
 
 // Assertion handler
 function hub_assert_handler ($file, $line, $code) {
        // Empty code?
        if ($code === '') {
                $code = '<em>Unknown</em>';
-       } // END - if
+       }
 
        // Create message
        $message = sprintf('File: %s, Line: %s, Code: %s',
@@ -138,7 +138,7 @@ function hub_assert_handler ($file, $line, $code) {
 
        // Throw an exception here
        throw new AssertionException($message, BaseFrameworkSystem::EXCEPTION_ASSERTION_FAILED);
-} // END - function
+}
 
 // Set error handler
 //set_error_handler('hub_error_handler');
index ed44183f04c1e27220548fee80eec33a24da97e0..6e6dce192ab27bfa82113a4ad6bfe7f090c2da4f 100644 (file)
@@ -47,16 +47,16 @@ foreach ($hasher as $hash) {
        if (!is_int($hash)) {
                $timers[str_replace('MHASH_', '', $hash)] = '- unavailable -';
                continue;
-       } // END - if
+       }
 
        $time = microtime(true);
        for ($idx = 0; $idx <= $count; $idx++) {
                $dummy = bin2hex(mhash($hash, 'mhash-test-abc-123-foo-bar'));
-       } // END - for
+       }
 
        $timers[mhash_get_hash_name($hash)] = (microtime(true) - $time);
        print '.';
-} // END - foreach
+}
 
 print "\r\n\r\n";
 asort($timers);
index a260db09d8083c3f464f387b80cf936870e32a8e..72518f9fe0e5260d8722a6eca95c9d5da08cb322 100644 (file)
@@ -43,12 +43,12 @@ function sendBye ($socket) {
                        if ($read == 'BYE') {
                                // Okay
                                $replied = true;
-                       } // END - if
-               } // END - if
+                       }
+               }
 
                // Sleep a little
                if (function_exists('time_nanosleep')) time_nanosleep(0, 500000);
-       } // END - while
+       }
 }
 
 $data = array();
@@ -84,7 +84,7 @@ while (!feof($socket)) {
        if ($failed == constant('MAX_FAILURES')) {
                //*DEBUG: */ out(__FILE__, __LINE__, "Too many failures! (failed={$failed})");
                break;
-       } // END - if
+       }
 
        // Is the peer the same?
        if (empty($peer)) {
@@ -116,7 +116,7 @@ while (!feof($socket)) {
                out(__FILE__, __LINE__, "Invalid packet {$read} received. count=".count($rec));
                $invalid++;
                continue;
-       } // END - if
+       }
 
        $time   = trim($rec[0]);
        $right  = explode('=', trim($rec[1]));
@@ -127,7 +127,7 @@ while (!feof($socket)) {
                out(__FILE__, __LINE__, "Invalid: ({$time}/{$hash}/{$hasher})");
                $invalid++;
                continue;
-       } // END - if
+       }
 
        if (!isset($data[$rec[0]])) {
                if (count($data) > 0) {
@@ -141,7 +141,7 @@ while (!feof($socket)) {
 
        // Sleep a little
        if (function_exists('time_nanosleep')) time_nanosleep(0, 500000);
-} // END - while
+}
 
 array_shift($data);
 
@@ -162,11 +162,11 @@ foreach ($data as $cnt) {
                $min = $cnt;
        }
        $avg += $cnt;
-} // END - foreach
+}
 
 if (count($data) > 0) {
        $avg = round($avg / count($data));
-} // END - if
+}
 
 out(__FILE__, __LINE__, 'MIN/AVG/MAX=' . $min . '/' . $avg . '/' . $max . '');
 out(__FILE__, __LINE__, 'INVALID=' . $invalid . '');
diff --git a/core b/core
index ac256a664aa490665d37705439807ab6d62a7e3a..a0f090cd1474ae446e0a480e22738cfa7b48412f 160000 (submodule)
--- a/core
+++ b/core
@@ -1 +1 @@
-Subproject commit ac256a664aa490665d37705439807ab6d62a7e3a
+Subproject commit a0f090cd1474ae446e0a480e22738cfa7b48412f