From d5813b87cab5b1d9a704b99186ca45e628322e28 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Thu, 18 Jul 2013 12:51:15 +0000 Subject: [PATCH] Changed all true/false to TRUE/FALSE respectively as PHP constants are better than keywords --- ...ass_NoRequestNodeListAttemptedException.php | 4 ++-- .../class_RequestNotAcceptedException.php | 4 ++-- .../handler/chunks/class_HandleableChunks.php | 2 +- .../helper/nodes/class_NodeHelper.php | 2 +- application/hub/main/class_BaseHubSystem.php | 2 +- .../console/class_HubConsoleMainCommand.php | 2 +- .../hub/main/dht/node/class_NodeDhtFacade.php | 4 ++-- .../socket/class_PackageSocketDiscovery.php | 12 ++++++------ .../main/handler/chunks/class_ChunkHandler.php | 18 +++++++++--------- .../class_NodeMessageAnnouncementHandler.php | 2 +- ...NodeMessageRequestNodeListAnswerHandler.php | 2 +- ...class_NodeMessageRequestNodeListHandler.php | 2 +- .../class_NodeMessageSelfConnectHandler.php | 2 +- .../main/handler/tasks/class_TaskHandler.php | 10 +++++----- .../connection/class_BaseConnectionHelper.php | 4 ++-- .../main/listener/tcp/class_TcpListener.php | 6 +++--- .../hub/main/nodes/class_BaseHubNode.php | 12 ++++++------ .../assembler/class_PackageAssembler.php | 2 +- .../hub/main/package/class_NetworkPackage.php | 10 +++++----- .../fragmenter/class_PackageFragmenter.php | 6 +++--- application/hub/main/pools/class_BasePool.php | 2 +- .../hub/main/producer/class_BaseProducer.php | 4 ++-- .../connection/class_ConnectionRegistry.php | 4 ++-- .../registry/socket/class_SocketRegistry.php | 2 +- .../class_XmlAnnouncementTemplateEngine.php | 2 +- ...ass_XmlAnnouncementAnswerTemplateEngine.php | 2 +- ..._XmlRequestNodeListAnswerTemplateEngine.php | 2 +- .../class_XmlDhtBootstrapTemplateEngine.php | 2 +- .../class_XmlSelfConnectTemplateEngine.php | 2 +- ...s_XmlRequestNodeListEntryTemplateEngine.php | 2 +- .../class_XmlObjectRegistryTemplateEngine.php | 2 +- ...class_XmlCruncherTestUnitTemplateEngine.php | 2 +- .../class_XmlRequestNodeListTemplateEngine.php | 2 +- application/hub/main/tools/class_HubTools.php | 2 +- index.php | 6 +++--- 35 files changed, 73 insertions(+), 73 deletions(-) diff --git a/application/hub/exceptions/requests/class_NoRequestNodeListAttemptedException.php b/application/hub/exceptions/requests/class_NoRequestNodeListAttemptedException.php index e02318eee..0ae3dc0ca 100644 --- a/application/hub/exceptions/requests/class_NoRequestNodeListAttemptedException.php +++ b/application/hub/exceptions/requests/class_NoRequestNodeListAttemptedException.php @@ -31,11 +31,11 @@ class NoRequestNodeListAttemptedException extends FrameworkException { */ public function __construct (array $messageData, $code) { // Construct the message - $message = sprintf("[%s:%d] This node (%s) didn't except a node-list request: %s", + $message = sprintf('[%s:%d] This node (%s) didn't except a node-list request: %s', $messageData[0]->__toString(), $this->getLine(), $messageData[1]->__toString(), - print_r($messageData[2], true) + print_r($messageData[2], TRUE) ); // Call parent exception constructor diff --git a/application/hub/exceptions/requests/class_RequestNotAcceptedException.php b/application/hub/exceptions/requests/class_RequestNotAcceptedException.php index 6fa9c0d9f..102ac990b 100644 --- a/application/hub/exceptions/requests/class_RequestNotAcceptedException.php +++ b/application/hub/exceptions/requests/class_RequestNotAcceptedException.php @@ -33,11 +33,11 @@ class RequestNotAcceptedException extends FrameworkException { */ public function __construct (array $messageData, $code) { // Construct the message - $message = sprintf("[%s:%d] This node (%s) does not accept request: %s", + $message = sprintf('[%s:%d] This node (%s) does not accept request: %s', $messageData[0]->__toString(), $this->getLine(), $messageData[1]->__toString(), - print_r($messageData[2], true) + print_r($messageData[2], TRUE) ); // Call parent exception constructor diff --git a/application/hub/interfaces/handler/chunks/class_HandleableChunks.php b/application/hub/interfaces/handler/chunks/class_HandleableChunks.php index b9d4b4724..16691f2dd 100644 --- a/application/hub/interfaces/handler/chunks/class_HandleableChunks.php +++ b/application/hub/interfaces/handler/chunks/class_HandleableChunks.php @@ -82,7 +82,7 @@ interface HandleableChunks extends Handleable { /** * Checks whether the raw package data has been assembled back together. * This can be safely assumed when rawPackageData is not empty and the - * collection of all chunks is false (because initHandler() will reset it). + * collection of all chunks is FALSE (because initHandler() will reset it). * * @return $isRawPackageDataAvailable Whether raw package data is available */ diff --git a/application/hub/interfaces/helper/nodes/class_NodeHelper.php b/application/hub/interfaces/helper/nodes/class_NodeHelper.php index 280fd9d8c..33d0978bf 100644 --- a/application/hub/interfaces/helper/nodes/class_NodeHelper.php +++ b/application/hub/interfaces/helper/nodes/class_NodeHelper.php @@ -60,7 +60,7 @@ interface NodeHelper extends Helper, AddableCriteria { /** * Activates the hub by doing some final preparation and setting - * $hubIsActive to true + * $hubIsActive to TRUE. * * @param $requestInstance A Requestable class * @param $responseInstance A Responseable class diff --git a/application/hub/main/class_BaseHubSystem.php b/application/hub/main/class_BaseHubSystem.php index 6d34489d6..d20ec95db 100644 --- a/application/hub/main/class_BaseHubSystem.php +++ b/application/hub/main/class_BaseHubSystem.php @@ -452,7 +452,7 @@ class BaseHubSystem extends BaseFrameworkSystem { $chunkSplits = explode(PackageFragmenter::CHUNK_DATA_HASH_SEPARATOR, $chunks[count($chunks) - 1]); // Make sure chunks with only 3 elements are parsed (for details see ChunkHandler) - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('eopChunk=' . $chunks[count($chunks) - 1] . ',chunkSplits=' . print_r($chunkSplits, true)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('eopChunk=' . $chunks[count($chunks) - 1] . ',chunkSplits=' . print_r($chunkSplits, TRUE)); assert(count($chunkSplits) == 3); // Validate final chunk diff --git a/application/hub/main/commands/console/class_HubConsoleMainCommand.php b/application/hub/main/commands/console/class_HubConsoleMainCommand.php index 581315540..bbfcab5cf 100644 --- a/application/hub/main/commands/console/class_HubConsoleMainCommand.php +++ b/application/hub/main/commands/console/class_HubConsoleMainCommand.php @@ -80,7 +80,7 @@ class HubConsoleMainCommand extends BaseCommand implements Commandable { /* * -------------------------- Hub activation -------------------------- * Activates the node by doing some final preparation steps and setting - * the attribute $hubIsActive to true + * the attribute $hubIsActive to TRUE. */ $nodeInstance->activateNode($requestInstance, $responseInstance); diff --git a/application/hub/main/dht/node/class_NodeDhtFacade.php b/application/hub/main/dht/node/class_NodeDhtFacade.php index 484b0c750..e37b76cf6 100644 --- a/application/hub/main/dht/node/class_NodeDhtFacade.php +++ b/application/hub/main/dht/node/class_NodeDhtFacade.php @@ -169,7 +169,7 @@ class NodeDhtFacade extends BaseDht implements Distributable, Registerable { $searchInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class'); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('DHT-FACADE[' . __LINE__ . ']: state=' . $this->getPrintableState() . ',messageData=' . print_r($messageData, true) . ',handlerInstance=' . $handlerInstance->__toString() . ',forceUpdate=' . intval($forceUpdate) . ',count(getSearchData())=' . count($handlerInstance->getSearchData())); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('DHT-FACADE[' . __LINE__ . ']: state=' . $this->getPrintableState() . ',messageData=' . print_r($messageData, TRUE) . ',handlerInstance=' . $handlerInstance->__toString() . ',forceUpdate=' . intval($forceUpdate) . ',count(getSearchData())=' . count($handlerInstance->getSearchData())); // Search for the node's session id and external IP/hostname + TCP/UDP listen port foreach ($handlerInstance->getSearchData() as $key) { @@ -228,7 +228,7 @@ class NodeDhtFacade extends BaseDht implements Distributable, Registerable { assert((isset($messageData[$excludeKey])) && (isset($messageData[$andKey]))); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('DHT-FACADE[' . __LINE__ . ']: state=' . $this->getPrintableState() . ',messageData=' . print_r($messageData, true)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('DHT-FACADE[' . __LINE__ . ']: state=' . $this->getPrintableState() . ',messageData=' . print_r($messageData, TRUE)); // Get a search criteria class $searchInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class'); diff --git a/application/hub/main/discovery/socket/class_PackageSocketDiscovery.php b/application/hub/main/discovery/socket/class_PackageSocketDiscovery.php index 9745185fc..840b9b668 100644 --- a/application/hub/main/discovery/socket/class_PackageSocketDiscovery.php +++ b/application/hub/main/discovery/socket/class_PackageSocketDiscovery.php @@ -122,7 +122,7 @@ class PackageSocketDiscovery extends BaseHubDiscovery implements DiscoverableSoc } // END - if // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('protocolName=' . $protocolName . ',packageData=' . print_r($packageData, true)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('protocolName=' . $protocolName . ',packageData=' . print_r($packageData, TRUE)); /* * Now we have the listener instance, we can determine the right @@ -134,12 +134,12 @@ class PackageSocketDiscovery extends BaseHubDiscovery implements DiscoverableSoc // Debug message if (is_resource($socketResource)) { - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('socketResource[' . gettype($socketResource) . ']=' . $socketResource . ',error=' . socket_strerror(socket_last_error($socketResource)) . ',packageData=' . print_r($packageData, true)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('socketResource[' . gettype($socketResource) . ']=' . $socketResource . ',error=' . socket_strerror(socket_last_error($socketResource)) . ',packageData=' . print_r($packageData, TRUE)); } else { - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('socketResource[' . gettype($socketResource) . ']=' . $socketResource . ',packageData=' . print_r($packageData, true)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('socketResource[' . gettype($socketResource) . ']=' . $socketResource . ',packageData=' . print_r($packageData, TRUE)); } - // Is it false, the recipient isn't known to us and we have no connection to it + // Is it FALSE, the recipient isn't known to us and we have no connection to it if (($socketResource === FALSE) || (!is_resource($socketResource)) || (socket_last_error($socketResource) > 0)) { // Try to create a new socket resource try { @@ -168,12 +168,12 @@ class PackageSocketDiscovery extends BaseHubDiscovery implements DiscoverableSoc // This cannot be fixed, so log it away self::createDebugInstance(__CLASS__)->debugOutput('SOCKET-DISCOVERY[' . __LINE__ . ']: Cannot discover socket resource for recipient ' . $packageData[NetworkPackage::PACKAGE_DATA_RECIPIENT] . ': ' . $e->getMessage()); - // Make any failed attempts to 'false' + // Make any failed attempts to 'FALSE' $socketResource = FALSE; } // And return it - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('SOCKET-DISCOVERY[' . __LINE__ . ']: socketResource=' . $socketResource . ',packageData=' . print_r($packageData, true)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('SOCKET-DISCOVERY[' . __LINE__ . ']: socketResource=' . $socketResource . ',packageData=' . print_r($packageData, TRUE)); return $socketResource; } } diff --git a/application/hub/main/handler/chunks/class_ChunkHandler.php b/application/hub/main/handler/chunks/class_ChunkHandler.php index 5a188e525..a7708cf2f 100644 --- a/application/hub/main/handler/chunks/class_ChunkHandler.php +++ b/application/hub/main/handler/chunks/class_ChunkHandler.php @@ -129,7 +129,7 @@ class ChunkHandler extends BaseHandler implements HandleableChunks, Registerable // ... and for the hashes 'hashes' => array(), // ... marker for that the final array is complete for assembling all chunks - 'is_complete' => false, + 'is_complete' => FALSE, // ... steps done to assemble all chunks 'assemble_steps' => 0, ); @@ -152,7 +152,7 @@ class ChunkHandler extends BaseHandler implements HandleableChunks, Registerable */ private function isChunkHashValid (array $chunkSplits) { // Now hash the raw data again - $chunkHash = $this->getCryptoInstance()->hashString($chunkSplits[self::CHUNK_SPLITS_INDEX_RAW_DATA], $chunkSplits[self::CHUNK_SPLITS_INDEX_HASH], false); + $chunkHash = $this->getCryptoInstance()->hashString($chunkSplits[self::CHUNK_SPLITS_INDEX_RAW_DATA], $chunkSplits[self::CHUNK_SPLITS_INDEX_HASH], FALSE); // Debug output //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('CHUNK-HANDLER[' . __LINE__ . ']: chunkHash=' . $chunkHash . ',chunkSplits[chunk_hash]=' . $chunkSplits[self::CHUNK_SPLITS_INDEX_HASH] . ',chunkSplits[serial]=' . $chunkSplits[self::CHUNK_SPLITS_INDEX_SERIAL] . ',chunkSplits[raw_data]=' . $chunkSplits[self::CHUNK_SPLITS_INDEX_RAW_DATA]); @@ -172,7 +172,7 @@ class ChunkHandler extends BaseHandler implements HandleableChunks, Registerable */ private function isSerialNumberValid ($serialNumber) { // Check it - $isValid = ((strlen($serialNumber) == PackageFragmenter::MAX_SERIAL_LENGTH) && ($this->hexval($serialNumber, false) === $serialNumber)); + $isValid = ((strlen($serialNumber) == PackageFragmenter::MAX_SERIAL_LENGTH) && ($this->hexval($serialNumber, FALSE) === $serialNumber)); // Return result return $isValid; @@ -246,9 +246,9 @@ class ChunkHandler extends BaseHandler implements HandleableChunks, Registerable * @return void */ private function preparePackageAssmble () { - // Make sure both arrays have same count (this however should always be true) + // Make sure both arrays have same count (this however should always be TRUE) assert(count($this->finalPackageChunks['hashes']) == count($this->finalPackageChunks['content'])); - //* DIE: */ exit(__METHOD__ . ':finalPackageChunks='.print_r($this->finalPackageChunks['content'],true)); + //* DIE: */ exit(__METHOD__ . ':finalPackageChunks='.print_r($this->finalPackageChunks['content'], TRUE)); /* * Remove last element (hash chunk) from 'hashes'. This hash will never @@ -316,7 +316,7 @@ class ChunkHandler extends BaseHandler implements HandleableChunks, Registerable foreach ($this->finalPackageChunks['content'] as $serialNumber => $content) { // Debug message //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('CHUNK-HANDLER[' . __LINE__ . ']: serialNumber=' . $serialNumber . ' - validating ...'); - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('finalPackageChunks=' . print_r($this->finalPackageChunks,true) . 'chunkHashes=' . print_r($this->chunkHashes,true)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('finalPackageChunks=' . print_r($this->finalPackageChunks, TRUE) . 'chunkHashes=' . print_r($this->chunkHashes, TRUE)); // Is this chunk valid? This should be the case assert($this->isChunkHashValid(array( @@ -332,7 +332,7 @@ class ChunkHandler extends BaseHandler implements HandleableChunks, Registerable } // END - foreach // Debug output - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('CHUNK-HANDLER[' . __LINE__ . ']: eopChunk[1]=' . $this->eopChunk[1] . ',' . chr(10) . 'index=' . (count($this->chunkHashes) - 2) . ',' . chr(10) . 'chunkHashes='.print_r($this->chunkHashes,true)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('CHUNK-HANDLER[' . __LINE__ . ']: eopChunk[1]=' . $this->eopChunk[1] . ',' . chr(10) . 'index=' . (count($this->chunkHashes) - 2) . ',' . chr(10) . 'chunkHashes='.print_r($this->chunkHashes, TRUE)); // The last chunk hash must match with the one from eopChunk[1] assert($this->eopChunk[1] == $this->chunkHashes[count($this->chunkHashes) - 2]); @@ -346,7 +346,7 @@ class ChunkHandler extends BaseHandler implements HandleableChunks, Registerable */ private function verifyRawPackageData () { // Hash the raw package data for final verification - $finalHash = $this->getCryptoInstance()->hashString($this->rawPackageData, $this->eopChunk[0], false); + $finalHash = $this->getCryptoInstance()->hashString($this->rawPackageData, $this->eopChunk[0], FALSE); // Is it the same? assert($finalHash == $this->eopChunk[0]); @@ -541,7 +541,7 @@ class ChunkHandler extends BaseHandler implements HandleableChunks, Registerable /** * Checks whether the raw package data has been assembled back together. * This can be safely assumed when rawPackageData is not empty and the - * collection of all chunks is false (because initHandler() will reset it). + * collection of all chunks is FALSE (because initHandler() will reset it). * * @return $isRawPackageDataAvailable Whether raw package data is available */ diff --git a/application/hub/main/handler/message-types/anouncement/class_NodeMessageAnnouncementHandler.php b/application/hub/main/handler/message-types/anouncement/class_NodeMessageAnnouncementHandler.php index 46b5bd6f9..4473eeeed 100644 --- a/application/hub/main/handler/message-types/anouncement/class_NodeMessageAnnouncementHandler.php +++ b/application/hub/main/handler/message-types/anouncement/class_NodeMessageAnnouncementHandler.php @@ -137,7 +137,7 @@ class NodeMessageAnnouncementHandler extends BaseMessageHandler implements Handl */ protected function initMessageConfigurationData (array $messageData) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('ANNOUNCEMENT-HANDLER[' . __LINE__ . ']: messageData=' . print_r($messageData, true)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('ANNOUNCEMENT-HANDLER[' . __LINE__ . ']: messageData=' . print_r($messageData, TRUE)); // "Walk" throught the translation array foreach ($this->messageToConfig as $messageKey => $configKey) { diff --git a/application/hub/main/handler/message-types/answer/class_NodeMessageRequestNodeListAnswerHandler.php b/application/hub/main/handler/message-types/answer/class_NodeMessageRequestNodeListAnswerHandler.php index 912357980..342f8c5ee 100644 --- a/application/hub/main/handler/message-types/answer/class_NodeMessageRequestNodeListAnswerHandler.php +++ b/application/hub/main/handler/message-types/answer/class_NodeMessageRequestNodeListAnswerHandler.php @@ -107,7 +107,7 @@ class NodeMessageRequestNodeListAnswerHandler extends BaseMessageHandler impleme parent::addArrayToDataSet($dataSetInstance, $messageData); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('ANSWER-HANDLER[' . __LINE__ . ']: messageData=' . print_r($messageData, true)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('ANSWER-HANDLER[' . __LINE__ . ']: messageData=' . print_r($messageData, TRUE)); // Add all ements foreach ($this->messageDataElements as $key) { diff --git a/application/hub/main/handler/message-types/requests/class_NodeMessageRequestNodeListHandler.php b/application/hub/main/handler/message-types/requests/class_NodeMessageRequestNodeListHandler.php index 2eb3c37ef..2d3cf3370 100644 --- a/application/hub/main/handler/message-types/requests/class_NodeMessageRequestNodeListHandler.php +++ b/application/hub/main/handler/message-types/requests/class_NodeMessageRequestNodeListHandler.php @@ -119,7 +119,7 @@ class NodeMessageRequestNodeListHandler extends BaseMessageHandler implements Ha */ protected function initMessageConfigurationData (array $messageData) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('REQUEST-HANDLER[' . __LINE__ . ']: messageData=' . print_r($messageData, true)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('REQUEST-HANDLER[' . __LINE__ . ']: messageData=' . print_r($messageData, TRUE)); // "Walk" throught the config-copy array foreach ($this->configCopy as $targetKey => $sourceKey) { diff --git a/application/hub/main/handler/message-types/self-connect/class_NodeMessageSelfConnectHandler.php b/application/hub/main/handler/message-types/self-connect/class_NodeMessageSelfConnectHandler.php index 446ac055f..3cab8b183 100644 --- a/application/hub/main/handler/message-types/self-connect/class_NodeMessageSelfConnectHandler.php +++ b/application/hub/main/handler/message-types/self-connect/class_NodeMessageSelfConnectHandler.php @@ -69,7 +69,7 @@ class NodeMessageSelfConnectHandler extends BaseMessageHandler implements Handle } else { // Something really horrible happened // @TODO Throw an exception here instead of dying - $this->debugInstance(__METHOD__ . ': ids mismatching! messageData=' . print_r($messageData, true)); + $this->debugInstance(__METHOD__ . ': ids mismatching! messageData=' . print_r($messageData, TRUE)); } } diff --git a/application/hub/main/handler/tasks/class_TaskHandler.php b/application/hub/main/handler/tasks/class_TaskHandler.php index 271a0a9c6..f1a92b1e6 100644 --- a/application/hub/main/handler/tasks/class_TaskHandler.php +++ b/application/hub/main/handler/tasks/class_TaskHandler.php @@ -99,7 +99,7 @@ class TaskHandler extends BaseHandler implements Registerable, HandleableTask { // Should we start now? if ($diff < $currentTask['task_startup_delay']) { // Skip this silently - return false; + return; } // END - if // Launch the task and mark it as updated @@ -122,7 +122,7 @@ class TaskHandler extends BaseHandler implements Registerable, HandleableTask { } // END - if // Skip this silently - return false; + return; } // END - if // Set last activity @@ -186,11 +186,11 @@ class TaskHandler extends BaseHandler implements Registerable, HandleableTask { // Identifier for the generateHash() method 'id' => $taskName, // Whether the task is started - 'task_started' => false, + 'task_started' => FALSE, // Whether the task is paused (not yet implemented) - 'task_paused' => false, + 'task_paused' => FALSE, // Whether the task can be paused (not yet implemented) - 'task_pauseable' => true, + 'task_pauseable' => TRUE, // Timestamp of registration 'task_registered' => $this->getMilliTime(), // Last activity timestamp diff --git a/application/hub/main/helper/connection/class_BaseConnectionHelper.php b/application/hub/main/helper/connection/class_BaseConnectionHelper.php index c9d7fa3c4..116903ec5 100644 --- a/application/hub/main/helper/connection/class_BaseConnectionHelper.php +++ b/application/hub/main/helper/connection/class_BaseConnectionHelper.php @@ -346,7 +346,7 @@ class BaseConnectionHelper extends BaseHubSystemHelper implements Registerable, // Is the required data there? //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('CONNECTION-HELPER[' . __LINE__ . ']: chunkHashes[]=' . count($chunkHashes) . ',chunkData[]=' . count($chunkData)); - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('chunkData='.print_r($chunkData,true)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('chunkData='.print_r($chunkData, TRUE)); if ((isset($chunkHashes[0])) && (isset($chunkData[0]))) { // Remember this chunk as queued $this->queuedChunks[$chunkHashes[0]] = $chunkData[0]; @@ -487,7 +487,7 @@ class BaseConnectionHelper extends BaseHubSystemHelper implements Registerable, $this->shuttedDown = TRUE; // And remove the (now invalid) socket - $this->setSocketResource(false); + $this->setSocketResource(FALSE); } /** diff --git a/application/hub/main/listener/tcp/class_TcpListener.php b/application/hub/main/listener/tcp/class_TcpListener.php index 680ab86b5..ac9b0f8ee 100644 --- a/application/hub/main/listener/tcp/class_TcpListener.php +++ b/application/hub/main/listener/tcp/class_TcpListener.php @@ -217,14 +217,14 @@ class TcpListener extends BaseListener implements Listenable { // Some new peers found? if ($left < 1) { // Debug message - //* EXTREME-NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('TCP-LISTENER[' . __LINE__ . ']: left=' . $left . ',serverSocket=' . $this->getSocketResource() . ',readers=' . print_r($readers, true)); + //* EXTREME-NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('TCP-LISTENER[' . __LINE__ . ']: left=' . $left . ',serverSocket=' . $this->getSocketResource() . ',readers=' . print_r($readers, TRUE)); // Nothing new found return; } // END - if // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('TCP-LISTENER[' . __LINE__ . ']: serverSocket=' . $this->getSocketResource() . ',readers=' . print_r($readers, true)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('TCP-LISTENER[' . __LINE__ . ']: serverSocket=' . $this->getSocketResource() . ',readers=' . print_r($readers, TRUE)); // Do we have changed peers? if (in_array($this->getSocketResource(), $readers)) { @@ -258,7 +258,7 @@ class TcpListener extends BaseListener implements Listenable { // Output result (only for debugging!) /* $option = socket_get_option($newSocket, SOL_SOCKET, SO_RCVTIMEO); - self::createDebugInstance(__CLASS__)->debugOutput('SO_RCVTIMEO[' . gettype($option) . ']=' . print_r($option, true)); + self::createDebugInstance(__CLASS__)->debugOutput('SO_RCVTIMEO[' . gettype($option) . ']=' . print_r($option, TRUE)); */ // Enable SO_OOBINLINE diff --git a/application/hub/main/nodes/class_BaseHubNode.php b/application/hub/main/nodes/class_BaseHubNode.php index 1b052c5b9..ac6362881 100644 --- a/application/hub/main/nodes/class_BaseHubNode.php +++ b/application/hub/main/nodes/class_BaseHubNode.php @@ -52,18 +52,18 @@ class BaseHubNode extends BaseHubSystem implements Updateable, AddableCriteria { private $queueConnectorInstance = NULL; /** - * Whether this node is anncounced (KEEP ON false!) + * Whether this node is anncounced (keep on FALSE!) * @deprecated */ private $hubIsAnnounced = FALSE; /** - * Whether this hub is active (default: false) + * Whether this hub is active (default: FALSE) */ private $isActive = FALSE; /** - * Whether this node accepts announcements (default: false) + * Whether this node accepts announcements (default: FALSE) */ private $acceptAnnouncements = FALSE; @@ -510,7 +510,7 @@ class BaseHubNode extends BaseHubSystem implements Updateable, AddableCriteria { /** * Activates the hub by doing some final preparation and setting - * $hubIsActive to true + * $hubIsActive to TRUE. * * @param $requestInstance A Requestable class * @param $responseInstance A Responseable class @@ -681,7 +681,7 @@ class BaseHubNode extends BaseHubSystem implements Updateable, AddableCriteria { /** * Enables whether this node accepts announcements * - * @param $acceptAnnouncements Whether this node accepts announcements (default: true) + * @param $acceptAnnouncements Whether this node accepts announcements (default: TRUE) * @return void */ protected final function enableAcceptingAnnouncements ($acceptAnnouncements = TRUE) { @@ -697,7 +697,7 @@ class BaseHubNode extends BaseHubSystem implements Updateable, AddableCriteria { /* * Only 'regular' nodes does not accept such requests, checking * HubRegularNode is faster, but if e.g. HubRegularI2PNode will be - * added then the next check will be true. + * added then the next check will be TRUE. */ $acceptsRequest = ((!$this instanceof HubRegularNode) && ($this->getRequestInstance()->getRequestElement('mode') != self::NODE_TYPE_REGULAR)); diff --git a/application/hub/main/package/assembler/class_PackageAssembler.php b/application/hub/main/package/assembler/class_PackageAssembler.php index 866bc2ea0..938f6c621 100644 --- a/application/hub/main/package/assembler/class_PackageAssembler.php +++ b/application/hub/main/package/assembler/class_PackageAssembler.php @@ -151,7 +151,7 @@ class PackageAssembler extends BaseHubSystem implements Assembler, Registerable //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('PACKAGE-ASSEMBLER: Partial data received. Waiting for more ... ( ' . strlen($packageContent[BaseRawDataHandler::PACKAGE_RAW_DATA]) . ' bytes)'); } else { // Debug message - /* DEBUG */ self::createDebugInstance(__CLASS__)->debugOutput('PACKAGE-ASSEMBLER: packageContent=' . print_r($packageContent,true) . ',chunks='.print_r($chunks,true)); + /* DEBUG */ self::createDebugInstance(__CLASS__)->debugOutput('PACKAGE-ASSEMBLER: packageContent=' . print_r($packageContent, TRUE) . ',chunks='.print_r($chunks, TRUE)); } } diff --git a/application/hub/main/package/class_NetworkPackage.php b/application/hub/main/package/class_NetworkPackage.php index d7507b03f..df1ff642a 100644 --- a/application/hub/main/package/class_NetworkPackage.php +++ b/application/hub/main/package/class_NetworkPackage.php @@ -560,7 +560,7 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R */ private function generatePackageSignature ($content, $senderId) { // Hash content and sender id together, use md5() as last algo - $hash = md5($this->getCryptoInstance()->hashString($senderId . $content, $this->getPrivateKey(), false)); + $hash = md5($this->getCryptoInstance()->hashString($senderId . $content, $this->getPrivateKey(), FALSE)); // Encrypt the content again with the hash as a key $encryptedContent = $this->getCryptoInstance()->encryptString($content, $hash); @@ -586,7 +586,7 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R // Is it the same? //$isSignatureValid = - exit(__METHOD__.': signature='.$signature.chr(10).',decodedArray='.print_r($decodedArray,true)); + exit(__METHOD__.': signature='.$signature.chr(10).',decodedArray='.print_r($decodedArray, TRUE)); } /** @@ -869,7 +869,7 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R $decodedData = $handlerInstance->getNextRawData(); // Very noisy debug message: - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('NETWORK-PACKAGE[' . __LINE__ . ']: decodedData[' . gettype($decodedData) . ']=' . print_r($decodedData, true)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('NETWORK-PACKAGE[' . __LINE__ . ']: decodedData[' . gettype($decodedData) . ']=' . print_r($decodedData, TRUE)); // And push it on our stack $this->getStackerInstance()->pushNamed(self::STACKER_NAME_DECODED_INCOMING, $decodedData); @@ -960,7 +960,7 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R */ public function clearAllStacker () { // Call the init method to force re-initialization - $this->initStackers(true); + $this->initStackers(TRUE); // Debug message //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('NETWORK-PACKAGE[' . __LINE__ . ']: All stacker have been re-initialized.'); @@ -1134,7 +1134,7 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R $messageArray[self::MESSAGE_ARRAY_DATA][self::MESSAGE_ARRAY_TYPE] = $messageArray[self::MESSAGE_ARRAY_TYPE]; // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('NETWORK-PACKAGE[' . __LINE__ . ']: messageArray=' . print_r($messageArray, true)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('NETWORK-PACKAGE[' . __LINE__ . ']: messageArray=' . print_r($messageArray, TRUE)); // Create a handler instance from given message type $handlerInstance = MessageTypeHandlerFactory::createMessageTypeHandlerInstance($messageArray[self::MESSAGE_ARRAY_TYPE]); diff --git a/application/hub/main/package/fragmenter/class_PackageFragmenter.php b/application/hub/main/package/fragmenter/class_PackageFragmenter.php index 519537af5..64bbb9324 100644 --- a/application/hub/main/package/fragmenter/class_PackageFragmenter.php +++ b/application/hub/main/package/fragmenter/class_PackageFragmenter.php @@ -403,7 +403,7 @@ class PackageFragmenter extends BaseHubSystem implements Fragmentable, Registera $rawData = self::HASH_CHUNK_IDENTIFIER . implode(self::CHUNK_HASH_SEPARATOR, $this->chunkHashes[$finalHash]); // Prepend chunk - $this->addChunkData($finalHash, $rawData, true); + $this->addChunkData($finalHash, $rawData, TRUE); } /** @@ -480,7 +480,7 @@ class PackageFragmenter extends BaseHubSystem implements Fragmentable, Registera * * @param $finalHash Final hash for faster lookup * @return $rawDataChunk Raw package data chunk - * @throws AssertionException If $finalHash was not 'true' + * @throws AssertionException If $finalHash was not 'TRUE' */ public function getNextRawDataChunk ($finalHash) { // Debug message @@ -490,7 +490,7 @@ class PackageFragmenter extends BaseHubSystem implements Fragmentable, Registera // Get current chunk index $current = $this->getCurrentChunkPointer($finalHash); } catch (AssertionException $e) { - // This may happen when the final hash is true + // This may happen when the final hash is TRUE if ($finalHash === TRUE) { // Set current to null $current = NULL; diff --git a/application/hub/main/pools/class_BasePool.php b/application/hub/main/pools/class_BasePool.php index 025385875..f29e7c254 100644 --- a/application/hub/main/pools/class_BasePool.php +++ b/application/hub/main/pools/class_BasePool.php @@ -170,7 +170,7 @@ class BasePool extends BaseHubSystem implements Visitable { */ protected function isValidConnectionType ($connectionType) { // Is it valid? - $isValid = in_array($connectionType, $this->connectionTypes, true); + $isValid = in_array($connectionType, $this->connectionTypes, TRUE); // Return result return $isValid; diff --git a/application/hub/main/producer/class_BaseProducer.php b/application/hub/main/producer/class_BaseProducer.php index 0dca07cad..38f8c9b68 100644 --- a/application/hub/main/producer/class_BaseProducer.php +++ b/application/hub/main/producer/class_BaseProducer.php @@ -133,7 +133,7 @@ abstract class BaseProducer extends BaseFrameworkSystem { * @return void */ protected function initOutgoingQueue () { - $this->getOutgoingQueueInstance()->initStacker(self::STACKER_NAME_OUT_QUEUE, true); + $this->getOutgoingQueueInstance()->initStacker(self::STACKER_NAME_OUT_QUEUE, TRUE); } /** @@ -162,7 +162,7 @@ abstract class BaseProducer extends BaseFrameworkSystem { * @return void */ protected function initIncomingQueue () { - $this->getIncomingQueueInstance()->initStacker(self::STACKER_NAME_IN_QUEUE, true); + $this->getIncomingQueueInstance()->initStacker(self::STACKER_NAME_IN_QUEUE, TRUE); } /** diff --git a/application/hub/main/registry/connection/class_ConnectionRegistry.php b/application/hub/main/registry/connection/class_ConnectionRegistry.php index 4c786b3f9..11e43cdb2 100644 --- a/application/hub/main/registry/connection/class_ConnectionRegistry.php +++ b/application/hub/main/registry/connection/class_ConnectionRegistry.php @@ -108,7 +108,7 @@ class ConnectionRegistry extends BaseRegistry implements Register, RegisterableC /** * Checks whether given socket resource is registered. If $socketResource is - * false only the instance will be checked. + * FALSE only the instance will be checked. * * @param $connectionInstance An instance of a ConnectionHelper class * @param $socketResource A valid socket resource @@ -185,7 +185,7 @@ class ConnectionRegistry extends BaseRegistry implements Register, RegisterableC */ public function getRegisteredConnectionResource (ConnectionHelper $connectionInstance) { // The socket must be registered before we can return it - if (!$this->isConnectionRegistered($connectionInstance, false)) { + if (!$this->isConnectionRegistered($connectionInstance, FALSE)) { // Throw the exception throw new NoConnectionRegisteredException ($connectionInstance, self::CONNECTION_NOT_REGISTERED); } // END - if diff --git a/application/hub/main/registry/socket/class_SocketRegistry.php b/application/hub/main/registry/socket/class_SocketRegistry.php index b75c78204..d03d2eead 100644 --- a/application/hub/main/registry/socket/class_SocketRegistry.php +++ b/application/hub/main/registry/socket/class_SocketRegistry.php @@ -131,7 +131,7 @@ class SocketRegistry extends BaseRegistry implements Register, RegisterableSocke /** * Checks whether given socket resource is registered. If $socketResource is - * false only the instance will be checked. + * FALSE only the instance will be checked. * * @param $protocolInstance An instance of a ProtocolHandler class * @param $socketResource A valid socket resource diff --git a/application/hub/main/template/announcement/class_XmlAnnouncementTemplateEngine.php b/application/hub/main/template/announcement/class_XmlAnnouncementTemplateEngine.php index 684e6dafc..44c766e50 100644 --- a/application/hub/main/template/announcement/class_XmlAnnouncementTemplateEngine.php +++ b/application/hub/main/template/announcement/class_XmlAnnouncementTemplateEngine.php @@ -92,7 +92,7 @@ class XmlAnnouncementTemplateEngine extends BaseXmlTemplateEngine implements Com // Is this string empty? if (empty($characters)) { // Then skip it silently - return false; + return; } // END - if /* diff --git a/application/hub/main/template/answer/announcement/class_XmlAnnouncementAnswerTemplateEngine.php b/application/hub/main/template/answer/announcement/class_XmlAnnouncementAnswerTemplateEngine.php index 17feefd45..88b0457b5 100644 --- a/application/hub/main/template/answer/announcement/class_XmlAnnouncementAnswerTemplateEngine.php +++ b/application/hub/main/template/answer/announcement/class_XmlAnnouncementAnswerTemplateEngine.php @@ -98,7 +98,7 @@ class XmlAnnouncementAnswerTemplateEngine extends BaseXmlAnswerTemplateEngine im // Is this string empty? if (empty($characters)) { // Then skip it silently - return false; + return; } // END - if /* diff --git a/application/hub/main/template/answer/requests/class_XmlRequestNodeListAnswerTemplateEngine.php b/application/hub/main/template/answer/requests/class_XmlRequestNodeListAnswerTemplateEngine.php index b53290d0e..6989cee62 100644 --- a/application/hub/main/template/answer/requests/class_XmlRequestNodeListAnswerTemplateEngine.php +++ b/application/hub/main/template/answer/requests/class_XmlRequestNodeListAnswerTemplateEngine.php @@ -88,7 +88,7 @@ class XmlRequestNodeListAnswerTemplateEngine extends BaseXmlAnswerTemplateEngine // Is this string empty? if (empty($characters)) { // Then skip it silently - return false; + return; } // END - if /* diff --git a/application/hub/main/template/bootstrap/class_XmlDhtBootstrapTemplateEngine.php b/application/hub/main/template/bootstrap/class_XmlDhtBootstrapTemplateEngine.php index fd1606333..812e99d2d 100644 --- a/application/hub/main/template/bootstrap/class_XmlDhtBootstrapTemplateEngine.php +++ b/application/hub/main/template/bootstrap/class_XmlDhtBootstrapTemplateEngine.php @@ -92,7 +92,7 @@ class XmlDhtBootstrapTemplateEngine extends BaseXmlTemplateEngine implements Com // Is this string empty? if (empty($characters)) { // Then skip it silently - return false; + return; } // END - if /* diff --git a/application/hub/main/template/connect/class_XmlSelfConnectTemplateEngine.php b/application/hub/main/template/connect/class_XmlSelfConnectTemplateEngine.php index 6afba47d8..94e08d88a 100644 --- a/application/hub/main/template/connect/class_XmlSelfConnectTemplateEngine.php +++ b/application/hub/main/template/connect/class_XmlSelfConnectTemplateEngine.php @@ -83,7 +83,7 @@ class XmlSelfConnectTemplateEngine extends BaseXmlTemplateEngine implements Comp // Is this string empty? if (empty($characters)) { // Then skip it silently - return false; + return; } // END - if /* diff --git a/application/hub/main/template/entries/class_XmlRequestNodeListEntryTemplateEngine.php b/application/hub/main/template/entries/class_XmlRequestNodeListEntryTemplateEngine.php index 499d00e4c..4d50c1fed 100644 --- a/application/hub/main/template/entries/class_XmlRequestNodeListEntryTemplateEngine.php +++ b/application/hub/main/template/entries/class_XmlRequestNodeListEntryTemplateEngine.php @@ -70,7 +70,7 @@ class XmlRequestNodeListEntryTemplateEngine extends BaseXmlTemplateEngine implem // Is this string empty? if (empty($characters)) { // Then skip it silently - return false; + return; } // END - if // Assign data with matching variable here diff --git a/application/hub/main/template/objects/class_XmlObjectRegistryTemplateEngine.php b/application/hub/main/template/objects/class_XmlObjectRegistryTemplateEngine.php index ce64d5244..b1b7027c2 100644 --- a/application/hub/main/template/objects/class_XmlObjectRegistryTemplateEngine.php +++ b/application/hub/main/template/objects/class_XmlObjectRegistryTemplateEngine.php @@ -96,7 +96,7 @@ class XmlObjectRegistryTemplateEngine extends BaseXmlTemplateEngine implements C // Is this string empty? if (empty($characters)) { // Then skip it silently - return false; + return; } // END - if // Get current XML node name as an array index diff --git a/application/hub/main/template/producer/test_units/class_XmlCruncherTestUnitTemplateEngine.php b/application/hub/main/template/producer/test_units/class_XmlCruncherTestUnitTemplateEngine.php index 3da75d4b1..9f75d26a9 100644 --- a/application/hub/main/template/producer/test_units/class_XmlCruncherTestUnitTemplateEngine.php +++ b/application/hub/main/template/producer/test_units/class_XmlCruncherTestUnitTemplateEngine.php @@ -85,7 +85,7 @@ class XmlCruncherTestUnitTemplateEngine extends BaseXmlTemplateEngine implements // Is this string empty? if (empty($characters)) { // Then skip it silently - return false; + return; } // END - if // Assign the found characters to variable and use the last entry from diff --git a/application/hub/main/template/requests/class_XmlRequestNodeListTemplateEngine.php b/application/hub/main/template/requests/class_XmlRequestNodeListTemplateEngine.php index 282483428..879f7775e 100644 --- a/application/hub/main/template/requests/class_XmlRequestNodeListTemplateEngine.php +++ b/application/hub/main/template/requests/class_XmlRequestNodeListTemplateEngine.php @@ -80,7 +80,7 @@ class XmlRequestNodeListTemplateEngine extends BaseXmlTemplateEngine implements // Is this string empty? if (empty($characters)) { // Then skip it silently - return false; + return; } // END - if // Assign data with matching variable here diff --git a/application/hub/main/tools/class_HubTools.php b/application/hub/main/tools/class_HubTools.php index 17ad9dec3..33f1a9d83 100644 --- a/application/hub/main/tools/class_HubTools.php +++ b/application/hub/main/tools/class_HubTools.php @@ -131,7 +131,7 @@ class HubTools extends BaseHubSystem { // And ask it for session id by given ip:port $recipient = $selfInstance->getDhtInstance()->findNodeByIpPort($ipPort); - die(__METHOD__.':recipient=
'.print_r($recipient, true).'
' . PHP_EOL); + die(__METHOD__.':recipient=
'.print_r($recipient, TRUE).'
' . PHP_EOL); // Return result return $sessionId; diff --git a/index.php b/index.php index dfaeb8a31..2f8d830cd 100644 --- a/index.php +++ b/index.php @@ -159,7 +159,7 @@ final class ApplicationEntryPoint { exit(); } else { // Output message and die - exit(sprintf("[Main:] Emergency exit reached: %s", + exit(sprintf('[Main:] Emergency exit reached: %s', $message )); } @@ -206,10 +206,10 @@ final class ApplicationEntryPoint { } // END - class // Developer mode active? Comment out if no dev! -define('DEVELOPER', true); +define('DEVELOPER', TRUE); // Log all exceptions (only debug! This option can create large error logs) -//define('LOG_EXCEPTIONS', true); +//define('LOG_EXCEPTIONS', TRUE); //xdebug_start_trace(); -- 2.39.2