From: Roland Häder <roland@mxchange.org>
Date: Sat, 7 Nov 2020 16:25:59 +0000 (+0100)
Subject: Continued:
X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=3b182d1633e936618e118773da67fa41b24a6109;p=core.git

Continued:
- moved some instances from monolithic BaseFrameworkSystem to proper classes
- set more type-hints for primitive variables

Signed-off-by: Roland Häder <roland@mxchange.org>
---

diff --git a/framework/main/classes/class_BaseFrameworkSystem.php b/framework/main/classes/class_BaseFrameworkSystem.php
index 2fe41474..a9385580 100644
--- a/framework/main/classes/class_BaseFrameworkSystem.php
+++ b/framework/main/classes/class_BaseFrameworkSystem.php
@@ -13,16 +13,13 @@ use Org\Mxchange\CoreFramework\Database\Frontend\DatabaseWrapper;
 use Org\Mxchange\CoreFramework\EntryPoint\ApplicationEntryPoint;
 use Org\Mxchange\CoreFramework\Factory\Database\Wrapper\DatabaseWrapperFactory;
 use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
-use Org\Mxchange\CoreFramework\Filesystem\Block;
 use Org\Mxchange\CoreFramework\Filesystem\FilePointer;
-use Org\Mxchange\CoreFramework\Filesystem\FrameworkDirectory;
 use Org\Mxchange\CoreFramework\Filesystem\PathWriteProtectedException;
 use Org\Mxchange\CoreFramework\Generic\FrameworkInterface;
 use Org\Mxchange\CoreFramework\Generic\NullPointerException;
 use Org\Mxchange\CoreFramework\Generic\UnsupportedOperationException;
 use Org\Mxchange\CoreFramework\Handler\Handleable;
 use Org\Mxchange\CoreFramework\Helper\Helper;
-use Org\Mxchange\CoreFramework\Index\Indexable;
 use Org\Mxchange\CoreFramework\Lists\Listable;
 use Org\Mxchange\CoreFramework\Loader\ClassLoader;
 use Org\Mxchange\CoreFramework\Localization\ManageableLanguage;
@@ -189,26 +186,6 @@ abstract class BaseFrameworkSystem extends stdClass implements FrameworkInterfac
 	 */
 	private $pointerInstance = NULL;
 
-	/**
-	 * An instance of an Indexable class
-	 */
-	private $indexInstance = NULL;
-
-	/**
-	 * An instance of a Block class
-	 */
-	private $blockInstance = NULL;
-
-	/**
-	 * A FrameworkDirectory instance
-	 */
-	private $directoryInstance = NULL;
-
-	/**
-	 * The concrete output instance
-	 */
-	private $outputInstance = NULL;
-
 	/**
 	 * State instance
 	 */
@@ -293,50 +270,6 @@ abstract class BaseFrameworkSystem extends stdClass implements FrameworkInterfac
 	const EXCEPTION_INVALID_SOCKET               = 0x03e;
 	const EXCEPTION_SELF_INSTANCE                = 0x03f;
 
-	/**
-	 * Hexadecimal->Decimal translation array
-	 */
-	private static $hexdec = array(
-		'0' => 0,
-		'1' => 1,
-		'2' => 2,
-		'3' => 3,
-		'4' => 4,
-		'5' => 5,
-		'6' => 6,
-		'7' => 7,
-		'8' => 8,
-		'9' => 9,
-		'a' => 10,
-		'b' => 11,
-		'c' => 12,
-		'd' => 13,
-		'e' => 14,
-		'f' => 15
-	);
-
-	/**
-	 * Decimal->hexadecimal translation array
-	 */
-	private static $dechex = array(
-		 0 => '0',
-		 1 => '1',
-		 2 => '2',
-		 3 => '3',
-		 4 => '4',
-		 5 => '5',
-		 6 => '6',
-		 7 => '7',
-		 8 => '8',
-		 9 => '9',
-		10 => 'a',
-		11 => 'b',
-		12 => 'c',
-		13 => 'd',
-		14 => 'e',
-		15 => 'f'
-	);
-
 	/**
 	 * Startup time in miliseconds
 	 */
@@ -1045,63 +978,6 @@ abstract class BaseFrameworkSystem extends stdClass implements FrameworkInterfac
 		$this->pointerInstance = NULL;
 	}
 
-	/**
-	 * Setter for Indexable instance
-	 *
-	 * @param	$indexInstance	An instance of an Indexable class
-	 * @return	void
-	 */
-	protected final function setIndexInstance (Indexable $indexInstance) {
-		$this->indexInstance = $indexInstance;
-	}
-
-	/**
-	 * Getter for Indexable instance
-	 *
-	 * @return	$indexInstance	An instance of an Indexable class
-	 */
-	public final function getIndexInstance () {
-		return $this->indexInstance;
-	}
-
-	/**
-	 * Setter for Block instance
-	 *
-	 * @param	$blockInstance	An instance of an Block class
-	 * @return	void
-	 */
-	protected final function setBlockInstance (Block $blockInstance) {
-		$this->blockInstance = $blockInstance;
-	}
-
-	/**
-	 * Getter for Block instance
-	 *
-	 * @return	$blockInstance	An instance of an Block class
-	 */
-	public final function getBlockInstance () {
-		return $this->blockInstance;
-	}
-
-	/**
-	 * Setter for FrameworkDirectory instance
-	 *
-	 * @param	$directoryInstance	A FrameworkDirectory instance
-	 * @return	void
-	 */
-	protected final function setDirectoryInstance (FrameworkDirectory $directoryInstance) {
-		$this->directoryInstance = $directoryInstance;
-	}
-
-	/**
-	 * Getter for FrameworkDirectory instance
-	 *
-	 * @return	$directoryInstance	A FrameworkDirectory instance
-	 */
-	protected final function getDirectoryInstance () {
-		return $this->directoryInstance;
-	}
-
 	/**
 	 * Setter for state instance
 	 *
@@ -1121,25 +997,6 @@ abstract class BaseFrameworkSystem extends stdClass implements FrameworkInterfac
 		return $this->stateInstance;
 	}
 
-	/**
-	 * Setter for output instance
-	 *
-	 * @param	$outputInstance	The debug output instance
-	 * @return	void
-	 */
-	public final function setOutputInstance (OutputStreamer $outputInstance) {
-		$this->outputInstance = $outputInstance;
-	}
-
-	/**
-	 * Getter for output instance
-	 *
-	 * @return	$outputInstance	The debug output instance
-	 */
-	public final function getOutputInstance () {
-		return $this->outputInstance;
-	}
-
 	/**
 	 * Setter for call-back instance
 	 *
@@ -1784,143 +1641,6 @@ Loaded includes:
 		// Return result
 		return $hasSlept;
 	}
-	/**
-	 * Converts a hexadecimal string, even with negative sign as first string to
-	 * a decimal number using BC functions.
-	 *
-	 * This work is based on comment #86673 on php.net documentation page at:
-	 * <http://de.php.net/manual/en/function.dechex.php#86673>
-	 *
-	 * @param	$hex	Hexadecimal string
-	 * @return	$dec	Decimal number
-	 */
-	protected function hex2dec ($hex) {
-		// Convert to all lower-case
-		$hex = strtolower($hex);
-
-		// Detect sign (negative/positive numbers)
-		$sign = '';
-		if (substr($hex, 0, 1) == '-') {
-			$sign = '-';
-			$hex = substr($hex, 1);
-		} // END - if
-
-		// Decode the hexadecimal string into a decimal number
-		$dec = 0;
-		for ($i = strlen($hex) - 1, $e = 1; $i >= 0; $i--, $e = bcmul($e, 16)) {
-			$factor = self::$hexdec[substr($hex, $i, 1)];
-			$dec = bcadd($dec, bcmul($factor, $e));
-		} // END - for
-
-		// Return the decimal number
-		return $sign . $dec;
-	}
-
-	/**
-	 * Converts even very large decimal numbers, also signed, to a hexadecimal
-	 * string.
-	 *
-	 * This work is based on comment #97756 on php.net documentation page at:
-	 * <http://de.php.net/manual/en/function.hexdec.php#97756>
-	 *
-	 * @param	$dec		Decimal number, even with negative sign
-	 * @param	$maxLength	Optional maximum length of the string
-	 * @return	$hex	Hexadecimal string
-	 */
-	protected function dec2hex ($dec, $maxLength = 0) {
-		// maxLength can be zero or devideable by 2
-		assert(($maxLength == 0) || (($maxLength % 2) == 0));
-
-		// Detect sign (negative/positive numbers)
-		$sign = '';
-		if ($dec < 0) {
-			$sign = '-';
-			$dec = abs($dec);
-		} // END - if
-
-		// Encode the decimal number into a hexadecimal string
-		$hex = '';
-		do {
-			$hex = self::$dechex[($dec % (2 ^ 4))] . $hex;
-			$dec /= (2 ^ 4);
-		} while ($dec >= 1);
-
-		/*
-		 * Leading zeros are required for hex-decimal "numbers". In some
-		 * situations more leading zeros are wanted, so check for both
-		 * conditions.
-		 */
-		if ($maxLength > 0) {
-			// Prepend more zeros
-			$hex = str_pad($hex, $maxLength, '0', STR_PAD_LEFT);
-		} elseif ((strlen($hex) % 2) != 0) {
-			// Only make string's length dividable by 2
-			$hex = '0' . $hex;
-		}
-
-		// Return the hexadecimal string
-		return $sign . $hex;
-	}
-
-	/**
-	 * Converts a ASCII string (0 to 255) into a decimal number.
-	 *
-	 * @param	$asc	The ASCII string to be converted
-	 * @return	$dec	Decimal number
-	 */
-	protected function asc2dec ($asc) {
-		// Convert it into a hexadecimal number
-		$hex = bin2hex($asc);
-
-		// And back into a decimal number
-		$dec = $this->hex2dec($hex);
-
-		// Return it
-		return $dec;
-	}
-
-	/**
-	 * Converts a decimal number into an ASCII string.
-	 *
-	 * @param	$dec		Decimal number
-	 * @return	$asc	An ASCII string
-	 */
-	protected function dec2asc ($dec) {
-		// First convert the number into a hexadecimal string
-		$hex = $this->dec2hex($dec);
-
-		// Then convert it into the ASCII string
-		$asc = $this->hex2asc($hex);
-
-		// Return it
-		return $asc;
-	}
-
-	/**
-	 * Converts a hexadecimal number into an ASCII string. Negative numbers
-	 * are not allowed.
-	 *
-	 * @param	$hex	Hexadecimal string
-	 * @return	$asc	An ASCII string
-	 */
-	protected function hex2asc ($hex) {
-		// Check for length, it must be devideable by 2
-		//* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('hex='.$hex);
-		assert((strlen($hex) % 2) == 0);
-
-		// Walk the string
-		$asc = '';
-		for ($idx = 0; $idx < strlen($hex); $idx+=2) {
-			// Get the decimal number of the chunk
-			$part = hexdec(substr($hex, $idx, 2));
-
-			// Add it to the final string
-			$asc .= chr($part);
-		} // END - for
-
-		// Return the final string
-		return $asc;
-	}
 
 	/**
 	 * Checks whether the given encoded data was encoded with Base64
diff --git a/framework/main/classes/file_directories/binary/class_BaseBinaryFile.php b/framework/main/classes/file_directories/binary/class_BaseBinaryFile.php
index 6a128b75..c2ac5ddf 100644
--- a/framework/main/classes/file_directories/binary/class_BaseBinaryFile.php
+++ b/framework/main/classes/file_directories/binary/class_BaseBinaryFile.php
@@ -132,6 +132,11 @@ abstract class BaseBinaryFile extends BaseAbstractFile {
 	 */
 	private $currentBlock = '';
 
+	/**
+	 * An instance of a Block class
+	 */
+	private $blockInstance = NULL;
+
 	/**
 	 * Protected constructor
 	 *
@@ -146,6 +151,25 @@ abstract class BaseBinaryFile extends BaseAbstractFile {
 		$this->initCountersGapsArray();
 	}
 
+	/**
+	 * Setter for Block instance
+	 *
+	 * @param	$blockInstance	An instance of an Block class
+	 * @return	void
+	 */
+	protected final function setBlockInstance (Block $blockInstance) {
+		$this->blockInstance = $blockInstance;
+	}
+
+	/**
+	 * Getter for Block instance
+	 *
+	 * @return	$blockInstance	An instance of an Block class
+	 */
+	public final function getBlockInstance () {
+		return $this->blockInstance;
+	}
+
 	/**
 	 * Checks whether the abstracted file only contains gaps by counting all
 	 * gaps' bytes together and compare it to total length.
diff --git a/framework/main/classes/iterator/file/class_FileIterator.php b/framework/main/classes/iterator/file/class_FileIterator.php
index 3d4a3c57..ad9338a2 100644
--- a/framework/main/classes/iterator/file/class_FileIterator.php
+++ b/framework/main/classes/iterator/file/class_FileIterator.php
@@ -30,6 +30,11 @@ use Org\Mxchange\CoreFramework\Iterator\Filesystem\SeekableWritableFileIterator;
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 class FileIterator extends BaseIterator implements SeekableWritableFileIterator {
+	/**
+	 * An instance of a Block class
+	 */
+	private $blockInstance = NULL;
+
 	/**
 	 * Protected constructor
 	 *
@@ -58,6 +63,25 @@ class FileIterator extends BaseIterator implements SeekableWritableFileIterator
 		return $iteratorInstance;
 	}
 
+	/**
+	 * Setter for Block instance
+	 *
+	 * @param	$blockInstance	An instance of an Block class
+	 * @return	void
+	 */
+	protected final function setBlockInstance (Block $blockInstance) {
+		$this->blockInstance = $blockInstance;
+	}
+
+	/**
+	 * Getter for Block instance
+	 *
+	 * @return	$blockInstance	An instance of an Block class
+	 */
+	public final function getBlockInstance () {
+		return $this->blockInstance;
+	}
+
 	/**
 	 * Gets currently read data
 	 *
diff --git a/framework/main/classes/stacker/class_BaseStacker.php b/framework/main/classes/stacker/class_BaseStacker.php
index b352c2c5..12059306 100644
--- a/framework/main/classes/stacker/class_BaseStacker.php
+++ b/framework/main/classes/stacker/class_BaseStacker.php
@@ -54,7 +54,7 @@ abstract class BaseStacker extends BaseFrameworkSystem {
 	 * @return	void
 	 * @throws	AlreadyInitializedStackerException	If the stack is already initialized
 	 */
-	public function initStack ($stackerName, $forceReInit = false) {
+	public function initStack (string $stackerName, bool $forceReInit = false) {
 		// Is the stack already initialized?
 		if (($forceReInit === false) && ($this->isStackInitialized($stackerName))) {
 			// Then throw the exception
@@ -70,7 +70,7 @@ abstract class BaseStacker extends BaseFrameworkSystem {
 	 *
 	 * @return	void
 	 */
-	public function initStacks (array $stacks, $forceReInit = false) {
+	public function initStacks (array $stacks, bool $forceReInit = false) {
 		// "Walk" through all (more will be added as needed
 		foreach ($stacks as $stackerName) {
 			// Init this stack
@@ -84,7 +84,7 @@ abstract class BaseStacker extends BaseFrameworkSystem {
 	 * @param	$stackerName	Name of the stack
 	 * @return	$isInitialized	Whether the stack is initialized
 	 */
-	public function isStackInitialized ($stackerName) {
+	public function isStackInitialized (string $stackerName) {
 		// Is is there?
 		$isInitialized = ($this->isValidGenericArrayKey('stacks', $stackerName, 'entries'));
 
@@ -99,7 +99,7 @@ abstract class BaseStacker extends BaseFrameworkSystem {
 	 * @return	$isFull			Whether the stack is full
 	 * @throws	NoStackerException	If given stack is missing
 	 */
-	protected function isStackFull ($stackerName) {
+	protected function isStackFull (string $stackerName) {
 		// Is the stack not yet initialized?
 		if (!$this->isStackInitialized($stackerName)) {
 			// Throw an exception
@@ -120,7 +120,7 @@ abstract class BaseStacker extends BaseFrameworkSystem {
 	 * @return	$isEmpty			Whether the stack is empty
 	 * @throws	NoStackerException	If given stack is missing
 	 */
-	public function isStackEmpty ($stackerName) {
+	public function isStackEmpty (string $stackerName) {
 		// Is the stack not yet initialized?
 		if (!$this->isStackInitialized($stackerName)) {
 			// Throw an exception
@@ -141,7 +141,7 @@ abstract class BaseStacker extends BaseFrameworkSystem {
 	 * @return	$count			Size of stack (array count)
 	 * @throws	NoStackerException	If given stack is missing
 	 */
-	public function getStackCount ($stackerName) {
+	public function getStackCount (string $stackerName) {
 		// Is the stack not yet initialized?
 		if (!$this->isStackInitialized($stackerName)) {
 			// Throw an exception
@@ -163,7 +163,7 @@ abstract class BaseStacker extends BaseFrameworkSystem {
 	 * @return	void
 	 * @throws	FullStackerException	Thrown if the stack is full
 	 */
-	protected function addValue ($stackerName, $value) {
+	protected function addValue (string $stackerName, $value) {
 		// Is the stack not yet initialized or full?
 		if (!$this->isStackInitialized($stackerName)) {
 			// Then do it here
@@ -185,7 +185,7 @@ abstract class BaseStacker extends BaseFrameworkSystem {
 	 * @throws	NoStackerException	If the named stacker was not found
 	 * @throws	EmptyStackerException	If the named stacker is empty
 	 */
-	protected function getLastValue ($stackerName) {
+	protected function getLastValue (string $stackerName) {
 		// Is the stack not yet initialized or full?
 		if (!$this->isStackInitialized($stackerName)) {
 			// Throw an exception
@@ -210,7 +210,7 @@ abstract class BaseStacker extends BaseFrameworkSystem {
 	 * @throws	NoStackerException	If the named stacker was not found
 	 * @throws	EmptyStackerException	If the named stacker is empty
 	 */
-	protected function getFirstValue ($stackerName) {
+	protected function getFirstValue (string $stackerName) {
 		// Is the stack not yet initialized or full?
 		if (!$this->isStackInitialized($stackerName)) {
 			// Throw an exception
@@ -235,7 +235,7 @@ abstract class BaseStacker extends BaseFrameworkSystem {
 	 * @throws	NoStackerException	If the named stacker was not found
 	 * @throws	EmptyStackerException	If the named stacker is empty
 	 */
-	protected function popLast ($stackerName) {
+	protected function popLast (string $stackerName) {
 		// Is the stack not yet initialized or full?
 		if (!$this->isStackInitialized($stackerName)) {
 			// Throw an exception
@@ -257,7 +257,7 @@ abstract class BaseStacker extends BaseFrameworkSystem {
 	 * @throws	NoStackerException	If the named stacker was not found
 	 * @throws	EmptyStackerException	If the named stacker is empty
 	 */
-	protected function popFirst ($stackerName) {
+	protected function popFirst (string $stackerName) {
 		// Is the stack not yet initialized or full?
 		if (!$this->isStackInitialized($stackerName)) {
 			// Throw an exception
diff --git a/framework/main/classes/stacker/file/class_BaseFileStack.php b/framework/main/classes/stacker/file/class_BaseFileStack.php
index c84f3fb9..5ddc1ca0 100644
--- a/framework/main/classes/stacker/file/class_BaseFileStack.php
+++ b/framework/main/classes/stacker/file/class_BaseFileStack.php
@@ -7,6 +7,7 @@ use Org\Mxchange\CoreFramework\Factory\Filesystem\Stack\FileStackIndexFactory;
 use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
 use Org\Mxchange\CoreFramework\Filesystem\File\BaseBinaryFile;
 use Org\Mxchange\CoreFramework\Generic\UnsupportedOperationException;
+use Org\Mxchange\CoreFramework\Index\Indexable;
 use Org\Mxchange\CoreFramework\Iterator\Filesystem\SeekableWritableFileIterator;
 use Org\Mxchange\CoreFramework\Stacker\BaseStacker;
 
@@ -56,6 +57,11 @@ abstract class BaseFileStack extends BaseStacker {
 	 */
 	const ARRAY_INDEX_DATA_LENGTH = 'length';
 
+	/**
+	 * An instance of an Indexable class
+	 */
+	private $indexInstance = NULL;
+
 	/**
 	 * Protected constructor
 	 *
@@ -67,6 +73,25 @@ abstract class BaseFileStack extends BaseStacker {
 		parent::__construct($className);
 	}
 
+	/**
+	 * Setter for Indexable instance
+	 *
+	 * @param	$indexInstance	An instance of an Indexable class
+	 * @return	void
+	 */
+	protected final function setIndexInstance (Indexable $indexInstance) {
+		$this->indexInstance = $indexInstance;
+	}
+
+	/**
+	 * Getter for Indexable instance
+	 *
+	 * @return	$indexInstance	An instance of an Indexable class
+	 */
+	public final function getIndexInstance () {
+		return $this->indexInstance;
+	}
+
 	/**
 	 * Reads the file header
 	 *
@@ -74,23 +99,23 @@ abstract class BaseFileStack extends BaseStacker {
 	 * @todo	To hard assertions here, better rewrite them to exceptions
 	 */
 	public function readFileHeader () {
-		//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[%s:%d:] CALLED!', __METHOD__, __LINE__));
+		/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: CALLED!', __METHOD__, __LINE__));
 
 		// First rewind to beginning as the header sits at the beginning ...
 		$this->getIteratorInstance()->rewind();
 
 		// Then read it (see constructor for calculation)
 		$data = $this->getIteratorInstance()->read($this->getIteratorInstance()->getHeaderSize());
-		//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[%s:%d:] Read %d bytes (%d wanted).', __METHOD__, __LINE__, strlen($data), $this->getIteratorInstance()->getHeaderSize()));
+		/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: Read %d bytes (%d wanted).', strlen($data), $this->getIteratorInstance()->getHeaderSize()));
 
 		// Have all requested bytes been read?
 		assert(strlen($data) == $this->getIteratorInstance()->getHeaderSize());
-		//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[%s:%d:] Passed assert().', __METHOD__, __LINE__));
+		/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: Passed assert().', __METHOD__, __LINE__));
 
 		// Last character must be the separator
-		//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[%s:%d:] data(-1)=%s', __METHOD__, __LINE__, dechex(ord(substr($data, -1, 1)))));
+		/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: data(-1)=%s', dechex(ord(substr($data, -1, 1)))));
 		assert(substr($data, -1, 1) == chr(BaseBinaryFile::SEPARATOR_HEADER_ENTRIES));
-		//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[%s:%d:] Passed assert().', __METHOD__, __LINE__));
+		/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: Passed assert().', __METHOD__, __LINE__));
 
 		// Okay, then remove it
 		$data = substr($data, 0, -1);
@@ -111,25 +136,25 @@ abstract class BaseFileStack extends BaseStacker {
 		$this->getIteratorInstance()->setHeader($header);
 
 		// Check if the array has only 3 elements
-		//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[%s:%d:] header(%d)=%s', __METHOD__, __LINE__, count($header), print_r($header, true)));
+		/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: header(%d)=%s', count($header), print_r($header, true)));
 		assert(count($header) == 3);
-		//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[%s:%d:] Passed assert().', __METHOD__, __LINE__));
+		/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: Passed assert().', __METHOD__, __LINE__));
 
 		// Check magic
 		assert($header[0] == self::STACK_MAGIC);
-		//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[%s:%d:] Passed assert().', __METHOD__, __LINE__));
+		/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: Passed assert().', __METHOD__, __LINE__));
 
 		// Check length of count and seek position
 		assert(strlen($header[1]) == BaseBinaryFile::LENGTH_COUNT);
-		//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[%s:%d:] Passed assert().', __METHOD__, __LINE__));
+		/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: Passed assert().', __METHOD__, __LINE__));
 		assert(strlen($header[2]) == BaseBinaryFile::LENGTH_POSITION);
-		//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[%s:%d:] Passed assert().', __METHOD__, __LINE__));
+		/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: Passed assert().', __METHOD__, __LINE__));
 
 		// Decode count and seek position
 		$header[1] = hex2bin($header[1]);
 		$header[2] = hex2bin($header[2]);
 
-		//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[%s:%d:] EXIT!', __METHOD__, __LINE__));
+		/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: EXIT!', __METHOD__, __LINE__));
 	}
 
 	/**
@@ -138,7 +163,7 @@ abstract class BaseFileStack extends BaseStacker {
 	 * @return	void
 	 */
 	public function flushFileHeader () {
-		//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[%s:%d:] CALLED!', __METHOD__, __LINE__));
+		/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: CALLED!', __METHOD__, __LINE__));
 
 		// Put all informations together
 		$header = sprintf('%s%s%s%s%s%s',
@@ -164,7 +189,7 @@ abstract class BaseFileStack extends BaseStacker {
 		// Write it to disk (header is always at seek position 0)
 		$this->getIteratorInstance()->writeData(0, $header, false);
 
-		//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[%s:%d:] EXIT!', __METHOD__, __LINE__));
+		/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: EXIT!', __METHOD__, __LINE__));
 	}
 
 	/**
@@ -175,7 +200,7 @@ abstract class BaseFileStack extends BaseStacker {
 	 * @return	void
 	 * @todo	Currently the stack file is not cached, please implement a memory-handling class and if enough RAM is found, cache the whole stack file.
 	 */
-	protected function initFileStack (SplFileInfo $fileInfoInstance, $type) {
+	protected function initFileStack (SplFileInfo $fileInfoInstance, string $type) {
 		// Get a stack file instance
 		$fileInstance = ObjectFactory::createObjectByConfiguredName('stack_file_class', array($fileInfoInstance, $this));
 
@@ -234,17 +259,15 @@ abstract class BaseFileStack extends BaseStacker {
 	 * @return	void
 	 * @throws	FullStackerException	If the stack is full
 	 */
-	protected function addValue ($stackerName, $value) {
+	protected function addValue (string $stackerName, $value) {
 		// Do some tests
 		if ($this->isStackFull($stackerName)) {
 			// Stacker is full
 			throw new FullStackerException(array($this, $stackerName, $value), self::EXCEPTION_STACKER_IS_FULL);
 		} // END - if
 
-		// Debug message
-		//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . '] stackerName=' . $stackerName . ',value[' . gettype($value) . ']=' . print_r($value, true));
-
 		// No objects/resources are allowed as their serialization takes to long
+		/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . '] stackerName=' . $stackerName . ',value[' . gettype($value) . ']=' . print_r($value, true));
 		assert(!is_object($value));
 		assert(!is_resource($value));
 
@@ -265,7 +288,7 @@ abstract class BaseFileStack extends BaseStacker {
 	 * @return	$value			Value of last added value
 	 * @throws	EmptyStackerException	If the stack is empty
 	 */
-	protected function getLastValue ($stackerName) {
+	protected function getLastValue (string $stackerName) {
 		// Is the stack not yet initialized or full?
 		if ($this->isStackEmpty($stackerName)) {
 			// Throw an exception
@@ -287,7 +310,7 @@ abstract class BaseFileStack extends BaseStacker {
 	 * @return	$value			Value of last added value
 	 * @throws	EmptyStackerException	If the stack is empty
 	 */
-	protected function getFirstValue ($stackerName) {
+	protected function getFirstValue (string $stackerName) {
 		// Is the stack not yet initialized or full?
 		if ($this->isStackEmpty($stackerName)) {
 			// Throw an exception
@@ -309,7 +332,7 @@ abstract class BaseFileStack extends BaseStacker {
 	 * @return	$value			Value "poped" from array
 	 * @throws	EmptyStackerException	If the stack is empty
 	 */
-	protected function popLast ($stackerName) {
+	protected function popLast (string $stackerName) {
 		// Is the stack not yet initialized or full?
 		if ($this->isStackEmpty($stackerName)) {
 			// Throw an exception
@@ -328,7 +351,7 @@ abstract class BaseFileStack extends BaseStacker {
 	 * @return	$value			Value "shifted" from array
 	 * @throws	EmptyStackerException	If the named stacker is empty
 	 */
-	protected function popFirst ($stackerName) {
+	protected function popFirst (string $stackerName) {
 		// Is the stack not yet initialized or full?
 		if ($this->isStackEmpty($stackerName)) {
 			// Throw an exception
@@ -346,7 +369,7 @@ abstract class BaseFileStack extends BaseStacker {
 	 * @param	$stackerName	Name of the stack
 	 * @return	$isFull			Whether the stack is full
 	 */
-	protected function isStackFull ($stackerName) {
+	protected function isStackFull (string $stackerName) {
 		// File-based stacks will only run full if the disk space is low.
 		// @TODO Please implement this, returning false
 		$isFull = false;
@@ -362,7 +385,7 @@ abstract class BaseFileStack extends BaseStacker {
 	 * @return	$isEmpty			Whether the stack is empty
 	 * @throws	NoStackerException	If given stack is missing
 	 */
-	public function isStackEmpty ($stackerName) {
+	public function isStackEmpty (string $stackerName) {
 		// So, is the stack empty?
 		$isEmpty = (($this->getStackCount($stackerName)) == 0);
 
@@ -378,7 +401,7 @@ abstract class BaseFileStack extends BaseStacker {
 	 * @return	void
 	 * @throws	UnsupportedOperationException	This method is not (and maybe never will be) supported
 	 */
-	public function initStack ($stackerName, $forceReInit = false) {
+	public function initStack (string $stackerName, bool $forceReInit = false) {
 		throw new UnsupportedOperationException(array($this, __FUNCTION__, $this->getIteratorInstance()->getPointerInstance()), self::EXCEPTION_UNSPPORTED_OPERATION);
 	}
 
@@ -388,7 +411,7 @@ abstract class BaseFileStack extends BaseStacker {
 	 * @return	void
 	 * @throws	UnsupportedOperationException	This method is not (and maybe never will be) supported
 	 */
-	public function initStacks (array $stacks, $forceReInit = false) {
+	public function initStacks (array $stacks, bool $forceReInit = false) {
 		throw new UnsupportedOperationException(array($this, __FUNCTION__, $this->getIteratorInstance()->getPointerInstance()), self::EXCEPTION_UNSPPORTED_OPERATION);
 	}
 
@@ -399,7 +422,7 @@ abstract class BaseFileStack extends BaseStacker {
 	 * @return	$isInitialized	Whether the stack is initialized
 	 * @throws	UnsupportedOperationException	This method is not (and maybe never will be) supported
 	 */
-	public function isStackInitialized ($stackerName) {
+	public function isStackInitialized (string $stackerName) {
 		throw new UnsupportedOperationException(array($this, __FUNCTION__, $this->getIteratorInstance()->getPointerInstance()), self::EXCEPTION_UNSPPORTED_OPERATION);
 	}
 
@@ -419,7 +442,7 @@ abstract class BaseFileStack extends BaseStacker {
 	 * @param	$stackerName	Name of the stack
 	 * @return	$count			Size of stack (array count)
 	 */
-	public function getStackCount ($stackerName) {
+	public function getStackCount (string $stackerName) {
 		// Now, simply return the found count value, this must be up-to-date then!
 		return $this->getIteratorInstance()->getCounter();
 	}
@@ -473,7 +496,7 @@ abstract class BaseFileStack extends BaseStacker {
 	 * @return	void
 	 * @throws	UnsupportedOperationException	This method is not (and maybe never will be) supported
 	 */
-	public final function setHeaderSize ($headerSize) {
+	public final function setHeaderSize (int $headerSize) {
 		throw new UnsupportedOperationException(array($this, __FUNCTION__, $this->getIteratorInstance()->getPointerInstance()), self::EXCEPTION_UNSPPORTED_OPERATION);
 	}
 
@@ -527,8 +550,8 @@ abstract class BaseFileStack extends BaseStacker {
 	 * @return	void
 	 * @throws	UnsupportedOperationException	This method is not (and maybe never will be) supported
 	 */
-	public function writeData ($seekPosition, $data, $flushHeader = true) {
-		/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[%s:%d:] seekPosition=%s,data[]=%s,flushHeader=%d', __METHOD__, __LINE__, $seekPosition, gettype($data), intval($flushHeader)));
+	public function writeData ($seekPosition, $data, bool $flushHeader = true) {
+		/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: seekPosition=%s,data[]=%s,flushHeader=%d', $seekPosition, gettype($data), intval($flushHeader)));
 		throw new UnsupportedOperationException(array($this, __FUNCTION__, $this->getIteratorInstance()->getPointerInstance()), self::EXCEPTION_UNSPPORTED_OPERATION);
 	}
 
@@ -541,7 +564,7 @@ abstract class BaseFileStack extends BaseStacker {
 	 * @throws	UnsupportedOperationException	This method is not (and maybe never will be) supported
 	 */
 	public function writeValueToFile ($groupId, $value) {
-		/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[%s:%d:] groupId=%s,value[%s]=%s', __METHOD__, __LINE__, $groupId, gettype($value), print_r($value, true)));
+		/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: groupId=%s,value[%s]=%s', $groupId, gettype($value), print_r($value, true)));
 		throw new UnsupportedOperationException(array($this, __FUNCTION__, $this->getIteratorInstance()->getPointerInstance()), self::EXCEPTION_UNSPPORTED_OPERATION);
 	}
 
@@ -553,8 +576,8 @@ abstract class BaseFileStack extends BaseStacker {
 	 * @return	$seekPosition	Found next gap's seek position
 	 * @throws	UnsupportedOperationException	This method is not (and maybe never will be) supported
 	 */
-	public function searchNextGap ($length) {
-		/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[%s:%d:] length=%s', __METHOD__, __LINE__, $length));
+	public function searchNextGap (int $length) {
+		/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: length=%s', $length));
 		throw new UnsupportedOperationException(array($this, __FUNCTION__, $this->getIteratorInstance()->getPointerInstance()), self::EXCEPTION_UNSPPORTED_OPERATION);
 	}
 
@@ -576,11 +599,9 @@ abstract class BaseFileStack extends BaseStacker {
 	 * @param	$encoded	Encoded value to be written to the file
 	 * @return	$data		Gap position and length of the raw data
 	 */
-	public function writeDataToFreeGap ($groupId, $hash, $encoded) {
-		// Debug message
-		/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[%s:%d:] groupId=%s,hash=%s,encoded()=%d - CALLED!', __METHOD__, __LINE__, $groupId, $hash, strlen($encoded)));
-
+	public function writeDataToFreeGap ($groupId, string $hash, $encoded) {
 		// Raw data been written to the file
+		/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: groupId=%s,hash=%s,encoded()=%d - CALLED!', $groupId, $hash, strlen($encoded)));
 		$rawData = sprintf('%s%s%s%s%s',
 			$groupId,
 			BaseBinaryFile::SEPARATOR_GROUP_HASH,
@@ -589,30 +610,24 @@ abstract class BaseFileStack extends BaseStacker {
 			$encoded
 		);
 
-		// Debug message
-		/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[%s:%d:] groupId=%s,hash=%s,rawData()=%d', __METHOD__, __LINE__, $groupId, $hash, strlen($rawData)));
-
 		// Search for next free gap
+		/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: groupId=%s,hash=%s,rawData()=%d', $groupId, $hash, strlen($rawData)));
 		$gapPosition = $this->getIteratorInstance()->searchNextGap(strlen($rawData));
 
 		// Gap position cannot be smaller than header length + 1
 		assert($gapPosition > $this->getIteratorInstance()->getHeaderSize());
 
-		// Debug message
-		/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[%s:%d:] groupId=%s,hash=%s,gapPosition=%s', __METHOD__, __LINE__, $groupId, $hash, $gapPosition));
-
 		// Then write the data at that gap
+		/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: groupId=%s,hash=%s,gapPosition=%s', $groupId, $hash, $gapPosition));
 		$this->getIteratorInstance()->writeData($gapPosition, $rawData);
 
-		// Debug message
-		/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[%s:%d:] groupId=%s,hash=%s,rawData()=%d - EXIT!', __METHOD__, __LINE__, $groupId, $hash, strlen($rawData)));
-
 		// Return gap position, hash and length of raw data
-		return array(
+		/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: groupId=%s,hash=%s,rawData()=%d - EXIT!', $groupId, $hash, strlen($rawData)));
+		return [
 			self::ARRAY_INDEX_GAP_POSITION => $gapPosition,
 			self::ARRAY_INDEX_HASH         => $hash,
-			self::ARRAY_INDEX_DATA_LENGTH  => strlen($rawData)
-		);
+			self::ARRAY_INDEX_DATA_LENGTH  => strlen($rawData),
+		];
 	}
 
 }
diff --git a/framework/main/classes/utils/string/class_StringUtils.php b/framework/main/classes/utils/string/class_StringUtils.php
index 8d4a2280..d895d191 100644
--- a/framework/main/classes/utils/string/class_StringUtils.php
+++ b/framework/main/classes/utils/string/class_StringUtils.php
@@ -48,22 +48,66 @@ final class StringUtils extends BaseFrameworkSystem {
 	 * Array with bitmasks and such for pack/unpack methods to support both
 	 * 32-bit and 64-bit systems
 	 */
-	private static $packingData = array(
-		32 => array(
+	private static $packingData = [
+		32 => [
 			'step'   => 3,
 			'left'   => 0xffff0000,
 			'right'  => 0x0000ffff,
 			'factor' => 16,
 			'format' => 'II',
-		),
-		64 => array(
+		],
+		64 => [
 			'step'   => 7,
 			'left'   => 0xffffffff00000000,
 			'right'  => 0x00000000ffffffff,
 			'factor' => 32,
 			'format' => 'NN'
-		)
-	);
+		]
+	];
+
+	/**
+	 * Hexadecimal->Decimal translation array
+	 */
+	private static $hexdec = [
+		'0' => 0,
+		'1' => 1,
+		'2' => 2,
+		'3' => 3,
+		'4' => 4,
+		'5' => 5,
+		'6' => 6,
+		'7' => 7,
+		'8' => 8,
+		'9' => 9,
+		'a' => 10,
+		'b' => 11,
+		'c' => 12,
+		'd' => 13,
+		'e' => 14,
+		'f' => 15
+	];
+
+	/**
+	 * Decimal->hexadecimal translation array
+	 */
+	private static $dechex = [
+		 0 => '0',
+		 1 => '1',
+		 2 => '2',
+		 3 => '3',
+		 4 => '4',
+		 5 => '5',
+		 6 => '6',
+		 7 => '7',
+		 8 => '8',
+		 9 => '9',
+		10 => 'a',
+		11 => 'b',
+		12 => 'c',
+		13 => 'd',
+		14 => 'e',
+		15 => 'f'
+	];
 
 	/**
 	 * Simple 64-bit check, thanks to "Salman A" from stackoverflow.com:
@@ -191,6 +235,144 @@ final class StringUtils extends BaseFrameworkSystem {
 		return $price;
 	}
 
+	/**
+	 * Converts a hexadecimal string, even with negative sign as first string to
+	 * a decimal number using BC functions.
+	 *
+	 * This work is based on comment #86673 on php.net documentation page at:
+	 * <http://de.php.net/manual/en/function.dechex.php#86673>
+	 *
+	 * @param	$hex	Hexadecimal string
+	 * @return	$dec	Decimal number
+	 */
+	public static function hex2dec (string $hex) {
+		// Convert to all lower-case
+		$hex = strtolower($hex);
+
+		// Detect sign (negative/positive numbers)
+		$sign = '';
+		if (substr($hex, 0, 1) == '-') {
+			$sign = '-';
+			$hex = substr($hex, 1);
+		}
+
+		// Decode the hexadecimal string into a decimal number
+		$dec = 0;
+		for ($i = strlen($hex) - 1, $e = 1; $i >= 0; $i--, $e = bcmul($e, 16)) {
+			$factor = self::$hexdec[substr($hex, $i, 1)];
+			$dec = bcadd($dec, bcmul($factor, $e));
+		}
+
+		// Return the decimal number
+		return $sign . $dec;
+	}
+
+	/**
+	 * Converts even very large decimal numbers, also signed, to a hexadecimal
+	 * string.
+	 *
+	 * This work is based on comment #97756 on php.net documentation page at:
+	 * <http://de.php.net/manual/en/function.hexdec.php#97756>
+	 *
+	 * @param	$dec		Decimal number, even with negative sign
+	 * @param	$maxLength	Optional maximum length of the string
+	 * @return	$hex	Hexadecimal string
+	 */
+	public static function dec2hex (string $dec, int $maxLength = 0) {
+		// maxLength can be zero or devideable by 2
+		assert(($maxLength == 0) || (($maxLength % 2) == 0));
+
+		// Detect sign (negative/positive numbers)
+		$sign = '';
+		if ($dec < 0) {
+			$sign = '-';
+			$dec = abs($dec);
+		}
+
+		// Encode the decimal number into a hexadecimal string
+		$hex = '';
+		do {
+			$hex = self::$dechex[($dec % (2 ^ 4))] . $hex;
+			$dec /= (2 ^ 4);
+		} while ($dec >= 1);
+
+		/*
+		 * Leading zeros are required for hex-decimal "numbers". In some
+		 * situations more leading zeros are wanted, so check for both
+		 * conditions.
+		 */
+		if ($maxLength > 0) {
+			// Prepend more zeros
+			$hex = str_pad($hex, $maxLength, '0', STR_PAD_LEFT);
+		} elseif ((strlen($hex) % 2) != 0) {
+			// Only make string's length dividable by 2
+			$hex = '0' . $hex;
+		}
+
+		// Return the hexadecimal string
+		return $sign . $hex;
+	}
+
+	/**
+	 * Converts a ASCII string (0 to 255) into a decimal number.
+	 *
+	 * @param	$asc	The ASCII string to be converted
+	 * @return	$dec	Decimal number
+	 */
+	public static function asc2dec (string $asc) {
+		// Convert it into a hexadecimal number
+		$hex = bin2hex($asc);
+
+		// And back into a decimal number
+		$dec = self::hex2dec($hex);
+
+		// Return it
+		return $dec;
+	}
+
+	/**
+	 * Converts a decimal number into an ASCII string.
+	 *
+	 * @param	$dec		Decimal number
+	 * @return	$asc	An ASCII string
+	 */
+	public static function dec2asc (string $dec) {
+		// First convert the number into a hexadecimal string
+		$hex = self::dec2hex($dec);
+
+		// Then convert it into the ASCII string
+		$asc = self::hex2asc($hex);
+
+		// Return it
+		return $asc;
+	}
+
+	/**
+	 * Converts a hexadecimal number into an ASCII string. Negative numbers
+	 * are not allowed.
+	 *
+	 * @param	$hex	Hexadecimal string
+	 * @return	$asc	An ASCII string
+	 */
+	public static function hex2asc ($hex) {
+		// Check for length, it must be devideable by 2
+		//* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('hex='.$hex);
+		assert((strlen($hex) % 2) == 0);
+
+		// Walk the string
+		$asc = '';
+		for ($idx = 0; $idx < strlen($hex); $idx+=2) {
+			// Get the decimal number of the chunk
+			$part = hexdec(substr($hex, $idx, 2));
+
+			// Add it to the final string
+			$asc .= chr($part);
+		}
+
+		// Return the final string
+		return $asc;
+	}
+
 	/**
 	 * Pack a string into a "binary format". Please execuse me that this is
 	 * widely undocumented. :-(
diff --git a/framework/main/interfaces/block/class_Block.php b/framework/main/interfaces/block/class_Block.php
index bc3b9d43..3f3785f0 100644
--- a/framework/main/interfaces/block/class_Block.php
+++ b/framework/main/interfaces/block/class_Block.php
@@ -72,7 +72,7 @@ interface Block extends FrameworkInterface {
 	 * @param	$headerSize		Size of file header
 	 * @return	void
 	 */
-	function setHeaderSize ($headerSize);
+	function setHeaderSize (int $headerSize);
 
 	/**
 	 * Getter for header array
@@ -127,7 +127,7 @@ interface Block extends FrameworkInterface {
 	 * @param	$encoded	Encoded value to be written to the file
 	 * @return	$data		Gap position and length of the raw data
 	 */
-	function writeDataToFreeGap ($groupId, $hash, $encoded);
+	function writeDataToFreeGap ($groupId, string $hash, $encoded);
 
 	/**
 	 * Writes data at given position
@@ -137,7 +137,7 @@ interface Block extends FrameworkInterface {
 	 * @param	$flushHeader	Whether to flush the header (default: flush)
 	 * @return	void
 	 */
-	function writeData ($seekPosition, $data, $flushHeader = true);
+	function writeData ($seekPosition, $data, bool $flushHeader = true);
 
 	/**
 	 * Searches for next suitable gap the given length of data can fit in
@@ -146,6 +146,6 @@ interface Block extends FrameworkInterface {
 	 * @param	$length			Length of raw data
 	 * @return	$seekPosition	Found next gap's seek position
 	 */
-	function searchNextGap ($length);
+	function searchNextGap (int $length);
 
 }
diff --git a/framework/main/interfaces/iterator/file/class_SeekableWritableFileIterator.php b/framework/main/interfaces/iterator/file/class_SeekableWritableFileIterator.php
index 91bcebfd..e2c9fe47 100644
--- a/framework/main/interfaces/iterator/file/class_SeekableWritableFileIterator.php
+++ b/framework/main/interfaces/iterator/file/class_SeekableWritableFileIterator.php
@@ -106,7 +106,7 @@ interface SeekableWritableFileIterator extends SeekableIterator {
 	 * @param	$headerSize		Size of file header
 	 * @return	void
 	 */
-	function setHeaderSize ($headerSize);
+	function setHeaderSize (int $headerSize);
 
 	/**
 	 * Getter for header array
@@ -152,7 +152,7 @@ interface SeekableWritableFileIterator extends SeekableIterator {
 	 * @param	$flushHeader	Whether to flush the header (default: flush)
 	 * @return	void
 	 */
-	function writeData ($seekPosition, $data, $flushHeader = true);
+	function writeData ($seekPosition, $data, bool $flushHeader = true);
 
 	/**
 	 * Getter for seek position
@@ -178,7 +178,7 @@ interface SeekableWritableFileIterator extends SeekableIterator {
 	 * @param	$encoded	Encoded value to be written to the file
 	 * @return	$data		Gap position and length of the raw data
 	 */
-	function writeDataToFreeGap ($groupId, $hash, $encoded);
+	function writeDataToFreeGap ($groupId, string $hash, $encoded);
 
 	/**
 	 * Searches for next suitable gap the given length of data can fit in
@@ -187,6 +187,6 @@ interface SeekableWritableFileIterator extends SeekableIterator {
 	 * @param	$length			Length of raw data
 	 * @return	$seekPosition	Found next gap's seek position
 	 */
-	function searchNextGap ($length);
+	function searchNextGap (int $length);
 
 }
diff --git a/framework/main/interfaces/stacker/class_Stackable.php b/framework/main/interfaces/stacker/class_Stackable.php
index c2574b4b..79199068 100644
--- a/framework/main/interfaces/stacker/class_Stackable.php
+++ b/framework/main/interfaces/stacker/class_Stackable.php
@@ -36,7 +36,7 @@ interface Stackable extends FrameworkInterface {
 	 * @return	void
 	 * @throws	StackerFullException	If the stacker is full
 	 */
-	function pushNamed ($stackerName, $value);
+	function pushNamed (string $stackerName, $value);
 
 	/**
 	 * 'Pops' a value from a named stacker and returns it's value
@@ -46,7 +46,7 @@ interface Stackable extends FrameworkInterface {
 	 * @throws	NoStackerException	If the named stacker was not found
 	 * @throws	EmptyStackerException	If the named stacker is empty
 	 */
-	function popNamed ($stackerName);
+	function popNamed (string $stackerName);
 
 	/**
 	 * Get value from named stacker but don't "pop" it
@@ -56,7 +56,7 @@ interface Stackable extends FrameworkInterface {
 	 * @throws	NoStackerException	If the named stacker was not found
 	 * @throws	EmptyStackerException	If the named stacker is empty
 	 */
-	function getNamed ($stackerName);
+	function getNamed (string $stackerName);
 
 	/**
 	 * Checks whether the given stack is initialized (set in array $stackers)
@@ -64,7 +64,7 @@ interface Stackable extends FrameworkInterface {
 	 * @param	$stackerName	Name of the stack
 	 * @return	$isInitialized	Whether the stack is initialized
 	 */
-	function isStackInitialized ($stackerName);
+	function isStackInitialized (string $stackerName);
 
 	/**
 	 * Checks whether the given stack is empty
@@ -73,6 +73,6 @@ interface Stackable extends FrameworkInterface {
 	 * @return	$isEmpty			Whether the stack is empty
 	 * @throws	NoStackerException	If given stack is missing
 	 */
-	function isStackEmpty ($stackerName);
+	function isStackEmpty (string $stackerName);
 
 }
diff --git a/framework/main/middleware/class_BaseMiddleware.php b/framework/main/middleware/class_BaseMiddleware.php
index 8c47444e..257bb3fa 100644
--- a/framework/main/middleware/class_BaseMiddleware.php
+++ b/framework/main/middleware/class_BaseMiddleware.php
@@ -4,6 +4,7 @@ namespace Org\Mxchange\CoreFramework\Middleware;
 
 // Import framework stuff
 use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem;
+use Org\Mxchange\CoreFramework\Stream\Output\OutputStreamer;
 
 /**
  * An abstract middleware class for all other middlware classes
@@ -28,6 +29,11 @@ use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem;
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 abstract class BaseMiddleware extends BaseFrameworkSystem {
+	/**
+	 * The concrete output instance
+	 */
+	private $outputInstance = NULL;
+
 	/**
 	 * Protected constructor
 	 *
@@ -39,4 +45,23 @@ abstract class BaseMiddleware extends BaseFrameworkSystem {
 		parent::__construct($className);
 	}
 
+	/**
+	 * Setter for output instance
+	 *
+	 * @param	$outputInstance	The debug output instance
+	 * @return	void
+	 */
+	protected final function setOutputInstance (OutputStreamer $outputInstance) {
+		$this->outputInstance = $outputInstance;
+	}
+
+	/**
+	 * Getter for output instance
+	 *
+	 * @return	$outputInstance	The debug output instance
+	 */
+	protected final function getOutputInstance () {
+		return $this->outputInstance;
+	}
+
 }
diff --git a/framework/main/middleware/debug/class_DebugMiddleware.php b/framework/main/middleware/debug/class_DebugMiddleware.php
index 9e18693c..0d913754 100644
--- a/framework/main/middleware/debug/class_DebugMiddleware.php
+++ b/framework/main/middleware/debug/class_DebugMiddleware.php
@@ -64,7 +64,7 @@ class DebugMiddleware extends BaseMiddleware implements Registerable {
 	 *							configured for
 	 * @return	$debugInstance	An instance of this middleware class
 	 */
-	public static final function createDebugMiddleware ($outputClass, $className) {
+	public static final function createDebugMiddleware (string $outputClass, string $className) {
 		//* DEBUG-DIE: */ die(__METHOD__.': outputClass=' . $outputClass . ',className=' . $className);
 
 		// Create an instance if this middleware
@@ -119,7 +119,7 @@ class DebugMiddleware extends BaseMiddleware implements Registerable {
 	 * @param	$stripTags	Whether HTML tags shall be stripped out
 	 * @return	void
 	 */
-	public final function output ($outStream, $stripTags = false) {
+	public final function output (string $outStream, bool $stripTags = false) {
 		// Is the output stream set
 		if (empty($outStream)) {
 			// @TODO Initialization phase