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 754c48bb2cba75d048d7b8fab1f173f6fed384b4..2f12a09798ebe83fe030a670165d9f05ba6f4b6e 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 217920972cee11886751fead79aae0ede6f89997..6c9dad6fad00f90653590482eda7f91cd4de341c 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 66f16db8f9cbeb18474610dff8be869c33a23b6c..aa32af1e3c1abbd2ee86ef29db4ecd35a2414e83 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 824771eecf5bd4f056220cac3e49cb9aa60aa81b..94ec780be3b41d1f0fa2c80f244e57929b1c0ec6 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 8bebdf2445960ee52a36b789edded13d6d760b34..c0e23b0c2d42f570c94232552df1420161da05b6 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 5e5a511d3d5f44c8ff2d81076ee2230354000902..91527e84bdf1b762230fdfe864e0c98bd47b667d 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 4aa880bb9aae1e33c8d1fd86015d011c4e544f9f..5d198a300a5232210c73d82c99bb7b53d567bac8 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__));
        }