]> git.mxchange.org Git - hub.git/commitdiff
Renamed more ...
authorRoland Häder <roland@mxchange.org>
Sat, 4 Aug 2012 23:30:35 +0000 (23:30 +0000)
committerRoland Häder <roland@mxchange.org>
Sat, 4 Aug 2012 23:30:35 +0000 (23:30 +0000)
application/hub/interfaces/package/assembler/class_Assembler.php
application/hub/main/handler/network/class_BaseRawDataHandler.php
application/hub/main/package/assembler/class_PackageAssembler.php
application/hub/main/package/class_NetworkPackage.php

index a5fbcdef7afd2d1aa6dbedaa11f4750cac64d506..0212ad01b9566e89052774438102b031c5e85fed 100644 (file)
@@ -26,7 +26,7 @@ interface Assembler extends FrameworkInterface {
         * Chunks the content from $packageContent and feeds it into another queue
         * for verification and possible re-requesting.
         *
-        * @param       $packageContent         An array with two elements: 'decoded_data' and 'error_code'
+        * @param       $packageContent         An array with two elements: 'raw_data' and 'error_code'
         * @return      void
         */
        function chunkPackageContent (array $packageContent);
index d7e067dcbb9b01ad847b6c241feef78b4db97a01..331f160fe5d2f256569b48faf3c8ebd736dc473c 100644 (file)
@@ -45,8 +45,8 @@ class BaseRawDataHandler extends BaseHandler {
        const PACKAGE_LEVEL_CHECK_OKAY         = 'checked_package'; // Package is fine
 
        // Package data
-       const PACKAGE_DECODED_DATA = 'decoded_data';
-       const PACKAGE_ERROR_CODE   = 'error_code';
+       const PACKAGE_RAW_DATA   = 'raw_data';
+       const PACKAGE_ERROR_CODE = 'error_code';
 
        /**
         * Stacker for raw data
index 9b1b2bdeeff79c818495697dba0f3fc156327bf9..ab4d468dbdaf1f36da20e8110281ab91e819f21d 100644 (file)
@@ -74,12 +74,12 @@ class PackageAssembler extends BaseHubSystem implements Assembler, Registerable
        /**
         * Checks whether given package content is completed (start/end markers are found)
         *
-        * @param       $packageContent         An array with two elements: 'decoded_data' and 'error_code'
+        * @param       $packageContent         An array with two elements: 'raw_data' and 'error_code'
         * @return      $isCompleted            Whether the given package content is completed
         */
        private function isPackageContentCompleted (array $packageContent) {
                // Check both
-               $isCompleted = ((substr($packageContent[BaseRawDataHandler::PACKAGE_DECODED_DATA], 0, 5) == '[[S]]') && (substr($packageContent[BaseRawDataHandler::PACKAGE_DECODED_DATA], -5, 5) == '[[E]]'));
+               $isCompleted = ((substr($packageContent[BaseRawDataHandler::PACKAGE_RAW_DATA], 0, 5) == '[[S]]') && (substr($packageContent[BaseRawDataHandler::PACKAGE_RAW_DATA], -5, 5) == '[[E]]'));
 
                // Return status
                return $isCompleted;
@@ -95,14 +95,14 @@ class PackageAssembler extends BaseHubSystem implements Assembler, Registerable
         * chunks and (maybe) re-request some chunks from the sender, this would
         * take to much time and therefore slow down this node again.
         *
-        * @param       $packageContent         An array with two elements: 'decoded_data' and 'error_code'
+        * @param       $packageContent         An array with two elements: 'raw_data' and 'error_code'
         * @return      void
         * @throws      UnsupportedPackageCodeHandlerException  If the package code handler is not implemented
         */
        public function chunkPackageContent (array $packageContent) {
                // Validate the package content array again
                assert(
-                       (isset($packageContent[BaseRawDataHandler::PACKAGE_DECODED_DATA])) &&
+                       (isset($packageContent[BaseRawDataHandler::PACKAGE_RAW_DATA])) &&
                        (isset($packageContent[BaseRawDataHandler::PACKAGE_ERROR_CODE]))
                );
 
@@ -129,31 +129,31 @@ class PackageAssembler extends BaseHubSystem implements Assembler, Registerable
         * some low checks on it and feeds it into another queue for verification
         * and re-request for bad chunks.
         *
-        * @param       $packageContent         An array with two elements: 'decoded_data' and 'error_code'
+        * @param       $packageContent         An array with two elements: 'raw_data' and 'error_code'
         * @return      void
         * @throws      FinalChunkVerificationException         If the final chunk does not start with 'EOP:'
         */
        private function handlePackageByUnhandledPackage (array $packageContent) {
                // Debug message
-               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('PACKAGE-ASSEMBLER: packageData[' . BaseRawDataHandler::PACKAGE_DECODED_DATA . ']=' . $packageContent[BaseRawDataHandler::PACKAGE_DECODED_DATA]);
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('PACKAGE-ASSEMBLER: packageData[' . BaseRawDataHandler::PACKAGE_RAW_DATA . ']=' . $packageContent[BaseRawDataHandler::PACKAGE_RAW_DATA]);
 
                // Check for some conditions
                if ((!$this->ifInputBufferIsEmpty()) || (!$this->isPackageContentCompleted($packageContent))) {
                        // Last chunk is not valid, so wait for more
-                       $this->pendingData .= $packageContent[BaseRawDataHandler::PACKAGE_DECODED_DATA];
+                       $this->pendingData .= $packageContent[BaseRawDataHandler::PACKAGE_RAW_DATA];
 
                        // Debug message
-                       /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('PACKAGE-ASSEMBLER: Partial data received. Waiting for more ... ( ' . strlen($packageContent[BaseRawDataHandler::PACKAGE_DECODED_DATA]) . ' bytes)');
+                       /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('PACKAGE-ASSEMBLER: Partial data received. Waiting for more ... ( ' . strlen($packageContent[BaseRawDataHandler::PACKAGE_RAW_DATA]) . ' bytes)');
                } else {
                        // Debug message
                        //* NOISY-DEBUG */ self::createDebugInstance(__CLASS__)->debugOutput('packageContent=' . print_r($packageContent,true) . ',chunks='.print_r($chunks,true));
 
                        /*
-                        * "explode" the string from 'decoded_data' with chunk separator to
+                        * "explode" the string from 'raw_data' with chunk separator to
                         * get an array of chunks. These chunks must then be verified by
                         * their checksums. Also the final chunk must be handled.
                         */
-                       $chunks = explode(PackageFragmenter::CHUNK_SEPARATOR, $packageContent[BaseRawDataHandler::PACKAGE_DECODED_DATA]);
+                       $chunks = explode(PackageFragmenter::CHUNK_SEPARATOR, $packageContent[BaseRawDataHandler::PACKAGE_RAW_DATA]);
 
                        // Now get a chunk handler instance
                        $handlerInstance = ChunkHandlerFactory::createChunkHandlerInstance();
@@ -188,7 +188,7 @@ class PackageAssembler extends BaseHubSystem implements Assembler, Registerable
 
                // Init fake array
                $packageContent = array(
-                       BaseRawDataHandler::PACKAGE_DECODED_DATA => $this->pendingData,
+                       BaseRawDataHandler::PACKAGE_RAW_DATA => $this->pendingData,
                        BaseRawDataHandler::PACKAGE_ERROR_CODE   => BaseRawDataHandler::SOCKET_ERROR_UNHANDLED
                );
 
@@ -196,7 +196,7 @@ class PackageAssembler extends BaseHubSystem implements Assembler, Registerable
                $this->pendingData = '';
 
                // Debug message
-               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('PACKAGE-ASSEMBLER: Last block of partial data received. A total of ' . strlen($packageContent[BaseRawDataHandler::PACKAGE_DECODED_DATA]) . ' bytes has been received.');
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('PACKAGE-ASSEMBLER: Last block of partial data received. A total of ' . strlen($packageContent[BaseRawDataHandler::PACKAGE_RAW_DATA]) . ' bytes has been received.');
 
                // Call the real handler method
                $this->handlePackageByUnhandledPackage($packageContent);
index 1a5a8d46e475ab34128bfab79f0f77e4a41d1a3b..a116d7cecf2f246c509f37f7fa219976a72162d9 100644 (file)
@@ -824,7 +824,7 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R
                // Make sure both array elements are there
                assert(
                        (is_array($decodedData)) &&
-                       (isset($decodedData[BaseRawDataHandler::PACKAGE_DECODED_DATA])) &&
+                       (isset($decodedData[BaseRawDataHandler::PACKAGE_RAW_DATA])) &&
                        (isset($decodedData[BaseRawDataHandler::PACKAGE_ERROR_CODE]))
                );
 
@@ -836,9 +836,9 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R
                assert($decodedData[BaseRawDataHandler::PACKAGE_ERROR_CODE] == BaseRawDataHandler::SOCKET_ERROR_UNHANDLED);
 
                // Remove the last chunk SEPARATOR (because it is being added and we don't need it)
-               if (substr($decodedData[BaseRawDataHandler::PACKAGE_DECODED_DATA], -1, 1) == PackageFragmenter::CHUNK_SEPARATOR) {
+               if (substr($decodedData[BaseRawDataHandler::PACKAGE_RAW_DATA], -1, 1) == PackageFragmenter::CHUNK_SEPARATOR) {
                        // It is there and should be removed
-                       $decodedData[BaseRawDataHandler::PACKAGE_DECODED_DATA] = substr($decodedData[BaseRawDataHandler::PACKAGE_DECODED_DATA], 0, -1);
+                       $decodedData[BaseRawDataHandler::PACKAGE_RAW_DATA] = substr($decodedData[BaseRawDataHandler::PACKAGE_RAW_DATA], 0, -1);
                } // END - if
 
                // This package is "handled" and can be pushed on the next stack
@@ -854,7 +854,7 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R
        public function addRawDataToIncomingStack (Networkable $handlerInstance) {
                /*
                 * Get the decoded data from the handler, this is an array with
-                * 'decoded_data' and 'error_code' as elements.
+                * 'raw_data' and 'error_code' as elements.
                 */
                $decodedData = $handlerInstance->getNextRawData();