Had to rename more stuff.
authorRoland Haeder <roland@mxchange.org>
Tue, 20 May 2014 18:47:37 +0000 (20:47 +0200)
committerRoland Haeder <roland@mxchange.org>
Tue, 20 May 2014 18:47:37 +0000 (20:47 +0200)
Signed-off-by: Roland H├Ąder <roland@mxchange.org>
inc/classes/interfaces/request/class_Requestable.php
inc/classes/main/class_BaseFrameworkSystem.php
inc/classes/main/index/class_BaseIndex.php
inc/classes/main/request/class_
inc/classes/main/request/console/class_ConsoleRequest.php
inc/classes/main/request/web/class_HttpRequest.php
inc/classes/main/stacker/file/class_BaseFileStack.php

index 754c48b..2f12a09 100644 (file)
@@ -60,7 +60,7 @@ interface Requestable extends FrameworkInterface {
         * @param       $headerName             Name of the header
         * @return      $headerValue    Value of the header or 'null' if not found
         */
-       function getHeader ($headerName);
+       function getHeaderElement ($headerName);
 
        /**
         * Sets whether the request was valid (default: TRUE)
index 2179209..6c9dad6 100644 (file)
@@ -2913,6 +2913,27 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
                $this->headerSize = $headerSize;
        }
 
+       /**
+        * Getter for header array
+        *
+        * @return      $totalEntries   Size of file header
+        */
+       protected final function getHeade () {
+               // Get it
+               return $this->header;
+       }
+
+       /**
+        * Setter for header
+        *
+        * @param       $header         Array for a file header
+        * @return      void
+        */
+       protected final function setHeader (array $header) {
+               // Set it
+               $this->header = $header;
+       }
+
        /**
         * Getter for seek position
         *
index 66f16db..aa32af1 100644 (file)
@@ -71,11 +71,11 @@ class BaseIndex extends BaseFrameworkSystem {
                $this->getIteratorInstance()->rewind();
 
                // Then read it (see constructor for calculation)
-               $data = $this->getIteratorInstance()->read($this->headerSize);
-               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] Read %d bytes (%d wanted).', __METHOD__, __LINE__, strlen($data), $this->headerSize));
+               $data = $this->getIteratorInstance()->read($this->getHeaderSize());
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] Read %d bytes (%d wanted).', __METHOD__, __LINE__, strlen($data), $this->getHeaderSize()));
 
                // Have all requested bytes been read?
-               assert(strlen($data) == $this->headerSize);
+               assert(strlen($data) == $this->getHeaderSize());
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] Passed assert().', __METHOD__, __LINE__));
 
                // Last character must be the separator
@@ -95,23 +95,26 @@ class BaseIndex extends BaseFrameworkSystem {
                 * 0 => magic
                 * 1 => total entries
                 */
-               $this->header = explode(chr(self::SEPARATOR_HEADER_DATA), $data);
+               $header = explode(chr(self::SEPARATOR_HEADER_DATA), $data);
+
+               // Set it here
+               $this->setHeader($header);
 
                // Check if the array has only 3 elements
-               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] header(%d)=%s', __METHOD__, __LINE__, count($this->header), print_r($this->header, TRUE)));
-               assert(count($this->header) == 2);
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] header(%d)=%s', __METHOD__, __LINE__, count($header), print_r($header, TRUE)));
+               assert(count($header) == 2);
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] Passed assert().', __METHOD__, __LINE__));
 
                // Check magic
-               assert($this->header[0] == self::INDEX_MAGIC);
+               assert($header[0] == self::INDEX_MAGIC);
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] Passed assert().', __METHOD__, __LINE__));
 
                // Check length of count
-               assert(strlen($this->header[1]) == self::LENGTH_COUNT);
+               assert(strlen($header[1]) == self::LENGTH_COUNT);
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] Passed assert().', __METHOD__, __LINE__));
 
                // Decode count
-               $this->header[1] = hex2bin($this->header[1]);
+               $header[1] = hex2bin($header[1]);
 
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] EXIT!', __METHOD__, __LINE__));
        }
index 824771e..94ec780 100644 (file)
@@ -64,7 +64,7 @@ class ???Request extends BaseRequest implements Requestable {
         * @param       $headerName             Name of the header
         * @return      $headerValue    Value of the header or 'null' if not found
         */
-       public function getHeader ($headerName) {
+       public function getHeaderElement ($headerName) {
                $this->partialStub("Please implement this method.");
        }
 
index 8bebdf2..c0e23b0 100644 (file)
@@ -92,7 +92,7 @@ class ConsoleRequest extends BaseRequest implements Requestable {
         * @return      $headerValue    Value of the header or 'null' if not found
         * @throws      UnsupportedOperationException   This method should never be called
         */
-       public function getHeader ($headerName) {
+       public function getHeaderElement ($headerName) {
                // Console doesn't have any headers
                throw new UnsupportedOperationException(array($this, __FUNCTION__, $executorInstance), self::EXCEPTION_UNSPPORTED_OPERATION);
        }
index 5e5a511..91527e8 100644 (file)
@@ -67,7 +67,7 @@ class HttpRequest extends BaseRequest implements Requestable {
         * @param       $headerName             Name of the header
         * @return      $headerValue    Value of the header or 'null' if not found
         */
-       public function getHeader ($headerName) {
+       public function getHeaderElement ($headerName) {
                // Default return value on error
                $headerValue = NULL;
 
index 4aa880b..5d198a3 100644 (file)
@@ -108,26 +108,29 @@ class BaseFileStack extends BaseStacker {
                 * 1 => total entries
                 * 2 => current seek position
                 */
-               $this->header = explode(chr(self::SEPARATOR_HEADER_DATA), $data);
+               $header = explode(chr(self::SEPARATOR_HEADER_DATA), $data);
+
+               // Set header here
+               $this->setHeader($header);
 
                // Check if the array has only 3 elements
-               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] header(%d)=%s', __METHOD__, __LINE__, count($this->header), print_r($this->header, TRUE)));
-               assert(count($this->header) == 3);
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] header(%d)=%s', __METHOD__, __LINE__, count($header), print_r($header, TRUE)));
+               assert(count($header) == 3);
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] Passed assert().', __METHOD__, __LINE__));
 
                // Check magic
-               assert($this->header[0] == self::STACK_MAGIC);
+               assert($header[0] == self::STACK_MAGIC);
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] Passed assert().', __METHOD__, __LINE__));
 
                // Check length of count and seek position
-               assert(strlen($this->header[1]) == self::LENGTH_COUNT);
+               assert(strlen($header[1]) == self::LENGTH_COUNT);
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] Passed assert().', __METHOD__, __LINE__));
-               assert(strlen($this->header[2]) == self::LENGTH_POSITION);
+               assert(strlen($header[2]) == self::LENGTH_POSITION);
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] Passed assert().', __METHOD__, __LINE__));
 
                // Decode count and seek position
-               $this->header[1] = hex2bin($this->header[1]);
-               $this->header[2] = hex2bin($this->header[2]);
+               $header[1] = hex2bin($header[1]);
+               $header[2] = hex2bin($header[2]);
 
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] EXIT!', __METHOD__, __LINE__));
        }