X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=framework%2Fmain%2Fclasses%2Fclass_BaseFrameworkSystem.php;h=38a45f3de6487ae05416f5e7fbff5ab4508723ec;hb=08a0c865dd2c8ee0b6dbf96f4f07e9ee0ce0f02b;hp=0cfc19bb40e37307ca2940a7703c7fb80b4fd785;hpb=3b3b3bc253fa9c4020022edba682db85326ff039;p=core.git diff --git a/framework/main/classes/class_BaseFrameworkSystem.php b/framework/main/classes/class_BaseFrameworkSystem.php index 0cfc19bb..38a45f3d 100644 --- a/framework/main/classes/class_BaseFrameworkSystem.php +++ b/framework/main/classes/class_BaseFrameworkSystem.php @@ -4,37 +4,25 @@ namespace Org\Mxchange\CoreFramework\Object; // Import framework stuff use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap; -use Org\Mxchange\CoreFramework\Criteria\Criteria; -use Org\Mxchange\CoreFramework\Criteria\Local\LocalSearchCriteria; -use Org\Mxchange\CoreFramework\Crypto\Cryptable; -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\Factory\Object\ObjectFactory; 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\Helper\Application\ApplicationHelper; use Org\Mxchange\CoreFramework\Loader\ClassLoader; -use Org\Mxchange\CoreFramework\Localization\ManageableLanguage; use Org\Mxchange\CoreFramework\Manager\ManageableApplication; use Org\Mxchange\CoreFramework\Middleware\Debug\DebugMiddleware; use Org\Mxchange\CoreFramework\Registry\GenericRegistry; use Org\Mxchange\CoreFramework\Result\Database\CachedDatabaseResult; -use Org\Mxchange\CoreFramework\Result\Search\SearchableResult; use Org\Mxchange\CoreFramework\State\Stateable; -use Org\Mxchange\CoreFramework\Stream\Input\InputStream; use Org\Mxchange\CoreFramework\Stream\Output\OutputStreamer; -use Org\Mxchange\CoreFramework\Stream\Output\OutputStream; -use Org\Mxchange\CoreFramework\User\ManageableAccount; -use Org\Mxchange\CoreFramework\Utils\String\StringUtils; +use Org\Mxchange\CoreFramework\Utils\Strings\StringUtils; // Import SPL stuff use \stdClass; use \InvalidArgumentException; -use \Iterator; use \ReflectionClass; use \SplFileInfo; @@ -44,7 +32,7 @@ use \SplFileInfo; * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2020 Core Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2021 Core Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.shipsimu.org * @@ -62,76 +50,16 @@ use \SplFileInfo; * along with this program. If not, see . */ abstract class BaseFrameworkSystem extends stdClass implements FrameworkInterface { - /** - * Length of output from hash() - */ - private static $hashLength = NULL; - /** * Self-referencing instance */ - private static $instance = NULL; + private static $selfInstance = NULL; /** * The real class name */ private $realClass = __CLASS__; - /** - * Search criteria instance - */ - private $searchInstance = NULL; - - /** - * Database result instance - */ - private $resultInstance = NULL; - - /** - * Instance for user class - */ - private $userInstance = NULL; - - /** - * Instance of a crypto helper - */ - private $cryptoInstance = NULL; - - /** - * Instance of an Iterator class - */ - private $iteratorInstance = NULL; - - /** - * A helper instance for the form - */ - private $helperInstance = NULL; - - /** - * An instance of a InputStream class - */ - private $inputStreamInstance = NULL; - - /** - * An instance of a OutputStream class - */ - private $outputStreamInstance = NULL; - - /** - * Handler instance - */ - private $handlerInstance = NULL; - - /** - * An instance of a database wrapper class - */ - private $wrapperInstance = NULL; - - /** - * State instance - */ - private $stateInstance = NULL; - /** * Call-back instance */ @@ -140,7 +68,7 @@ abstract class BaseFrameworkSystem extends stdClass implements FrameworkInterfac /** * Generic array */ - private $genericArray = array(); + private $genericArray = []; /*********************** * Exception codes.... * @@ -230,7 +158,7 @@ abstract class BaseFrameworkSystem extends stdClass implements FrameworkInterfac if (self::$startupTime == 0) { // Then set it self::$startupTime = microtime(true); - } // END - if + } } /** @@ -239,9 +167,6 @@ abstract class BaseFrameworkSystem extends stdClass implements FrameworkInterfac * @return void */ public function __destruct () { - // Flush any updated entries to the database - $this->flushPendingUpdates(); - // Is this object already destroyed? if ($this->__toString() != 'DestructedObject') { // Destroy all informations about this class but keep some text about it alive @@ -265,15 +190,15 @@ abstract class BaseFrameworkSystem extends stdClass implements FrameworkInterfac * @args $args Arguments passed to the method * @return void */ - public final function __call ($methodName, $args) { + public final function __call (string $methodName, array $args = NULL) { // Set self-instance - self::$instance = $this; + self::$selfInstance = $this; // Call static method self::__callStatic($methodName, $args); // Clear self-instance - self::$instance = NULL; + self::$selfInstance = NULL; } /** @@ -282,23 +207,21 @@ abstract class BaseFrameworkSystem extends stdClass implements FrameworkInterfac * @param $methodName Name of the missing method * @param $args Arguments passed to the method * @return void - * @throws InvalidArgumentException If self::$instance is not a framework's own object + * @throws InvalidArgumentException If self::$selfInstance is not a framework's own object */ - public static final function __callStatic ($methodName, $args) { - // Trace message - //* PRINT-DEBUG: */ printf('[%s:%d]: methodName=%s,args[]=%s - CALLED!' . PHP_EOL, __METHOD__, __LINE__, $methodName, gettype($args)); - + public static final function __callStatic (string $methodName, array $args = NULL) { // Init argument string and class name + //* PRINT-DEBUG: */ printf('[%s:%d]: methodName=%s,args[]=%s - CALLED!' . PHP_EOL, __METHOD__, __LINE__, $methodName, gettype($args)); $argsString = ''; $className = 'unknown'; // Is self-instance set? - if (self::$instance instanceof FrameworkInterface) { + if (self::$selfInstance instanceof FrameworkInterface) { // Framework's own instance - $className = self::$instance->__toString(); - } elseif (!is_null(self::$instance)) { + $className = self::$selfInstance->__toString(); + } elseif (!is_null(self::$selfInstance)) { // Invalid argument! - throw new InvalidArgumentException(sprintf('self::instance[%s] is not expected.', gettype(self::$instance)), self::EXCEPTION_SELF_INSTANCE); + throw new InvalidArgumentException(sprintf('self::instance[%s] is not expected.', gettype(self::$selfInstance)), self::EXCEPTION_SELF_INSTANCE); } // Is it NULL, empty or an array? @@ -342,19 +265,16 @@ abstract class BaseFrameworkSystem extends stdClass implements FrameworkInterfac // Comma for next one $argsString .= ', '; - } // END - foreach + } // Last comma found? if (substr($argsString, -2, 1) == ',') { // Remove last comma $argsString = substr($argsString, 0, -2); - } // END - if + } // Close braces $argsString .= ')'; - } else { - // Invalid arguments! - $argsString = sprintf('!INVALID:%s!', gettype($args)); } // Output stub message @@ -385,7 +305,7 @@ abstract class BaseFrameworkSystem extends stdClass implements FrameworkInterfac * @param $value Value to store * @return void */ - public final function __set ($name, $value) { + public final function __set (string $name, $value) { $this->debugBackTrace(sprintf('Tried to set a missing field. name=%s, value[%s]=%s', $name, gettype($value), @@ -399,7 +319,7 @@ abstract class BaseFrameworkSystem extends stdClass implements FrameworkInterfac * @param $name Name of the field/attribute * @return void */ - public final function __get ($name) { + public final function __get (string $name) { $this->debugBackTrace(sprintf('Tried to get a missing field. name=%s', $name )); @@ -411,7 +331,7 @@ abstract class BaseFrameworkSystem extends stdClass implements FrameworkInterfac * @param $name Name of the field/attribute * @return void */ - public final function __unset ($name) { + public final function __unset (string $name) { $this->debugBackTrace(sprintf('Tried to unset a missing field. name=%s', $name )); @@ -453,48 +373,9 @@ abstract class BaseFrameworkSystem extends stdClass implements FrameworkInterfac * @param $realClass Class name (string) * @return void */ - public final function setRealClass ($realClass) { + public final function setRealClass (string $realClass) { // Set real class - $this->realClass = (string) $realClass; - } - - /** - * Setter for database result instance - * - * @param $resultInstance An instance of a database result class - * @return void - * @todo SearchableResult and UpdateableResult shall have a super interface to use here - */ - protected final function setResultInstance (SearchableResult $resultInstance) { - $this->resultInstance = $resultInstance; - } - - /** - * Getter for database result instance - * - * @return $resultInstance An instance of a database result class - */ - public final function getResultInstance () { - return $this->resultInstance; - } - - /** - * Setter for search instance - * - * @param $searchInstance Searchable criteria instance - * @return void - */ - public final function setSearchInstance (LocalSearchCriteria $searchInstance) { - $this->searchInstance = $searchInstance; - } - - /** - * Getter for search instance - * - * @return $searchInstance Searchable criteria instance - */ - public final function getSearchInstance () { - return $this->searchInstance; + $this->realClass = $realClass; } /** @@ -540,198 +421,6 @@ abstract class BaseFrameworkSystem extends stdClass implements FrameworkInterfac return $webOutputInstance; } - /** - * Private getter for language instance - * - * @return $langInstance An instance to the language sub-system - */ - protected final function getLanguageInstance () { - $langInstance = GenericRegistry::getRegistry()->getInstance('language'); - return $langInstance; - } - - /** - * Setter for language instance - * - * @param $langInstance An instance to the language sub-system - * @return void - * @see LanguageSystem - */ - public final function setLanguageInstance (ManageableLanguage $langInstance) { - GenericRegistry::getRegistry()->addInstance('language', $langInstance); - } - - /** - * Protected setter for user instance - * - * @param $userInstance An instance of a user class - * @return void - */ - protected final function setUserInstance (ManageableAccount $userInstance) { - $this->userInstance = $userInstance; - } - - /** - * Getter for user instance - * - * @return $userInstance An instance of a user class - */ - public final function getUserInstance () { - return $this->userInstance; - } - - /** - * Setter for Cryptable instance - * - * @param $cryptoInstance An instance of a Cryptable class - * @return void - */ - protected final function setCryptoInstance (Cryptable $cryptoInstance) { - $this->cryptoInstance = $cryptoInstance; - } - - /** - * Getter for Cryptable instance - * - * @return $cryptoInstance An instance of a Cryptable class - */ - public final function getCryptoInstance () { - return $this->cryptoInstance; - } - - /** - * Setter for DatabaseWrapper instance - * - * @param $wrapperInstance An instance of an DatabaseWrapper - * @return void - */ - public final function setWrapperInstance (DatabaseWrapper $wrapperInstance) { - $this->wrapperInstance = $wrapperInstance; - } - - /** - * Getter for DatabaseWrapper instance - * - * @return $wrapperInstance An instance of an DatabaseWrapper - */ - public final function getWrapperInstance () { - return $this->wrapperInstance; - } - - /** - * Setter for helper instance - * - * @param $helperInstance An instance of a helper class - * @return void - */ - protected final function setHelperInstance (Helper $helperInstance) { - $this->helperInstance = $helperInstance; - } - - /** - * Getter for helper instance - * - * @return $helperInstance An instance of a helper class - */ - public final function getHelperInstance () { - return $this->helperInstance; - } - - /** - * Getter for a InputStream instance - * - * @param $inputStreamInstance The InputStream instance - */ - protected final function getInputStreamInstance () { - return $this->inputStreamInstance; - } - - /** - * Setter for a InputStream instance - * - * @param $inputStreamInstance The InputStream instance - * @return void - */ - protected final function setInputStreamInstance (InputStream $inputStreamInstance) { - $this->inputStreamInstance = $inputStreamInstance; - } - - /** - * Getter for a OutputStream instance - * - * @param $outputStreamInstance The OutputStream instance - */ - protected final function getOutputStreamInstance () { - return $this->outputStreamInstance; - } - - /** - * Setter for a OutputStream instance - * - * @param $outputStreamInstance The OutputStream instance - * @return void - */ - protected final function setOutputStreamInstance (OutputStream $outputStreamInstance) { - $this->outputStreamInstance = $outputStreamInstance; - } - - /** - * Setter for handler instance - * - * @param $handlerInstance An instance of a Handleable class - * @return void - */ - protected final function setHandlerInstance (Handleable $handlerInstance) { - $this->handlerInstance = $handlerInstance; - } - - /** - * Getter for handler instance - * - * @return $handlerInstance A Handleable instance - */ - protected final function getHandlerInstance () { - return $this->handlerInstance; - } - - /** - * Setter for Iterator instance - * - * @param $iteratorInstance An instance of an Iterator - * @return void - */ - protected final function setIteratorInstance (Iterator $iteratorInstance) { - $this->iteratorInstance = $iteratorInstance; - } - - /** - * Getter for Iterator instance - * - * @return $iteratorInstance An instance of an Iterator - */ - public final function getIteratorInstance () { - return $this->iteratorInstance; - } - - /** - * Setter for state instance - * - * @param $stateInstance A Stateable instance - * @return void - */ - public final function setStateInstance (Stateable $stateInstance) { - $this->stateInstance = $stateInstance; - } - - /** - * Getter for state instance - * - * @return $stateInstance A Stateable instance - */ - public final function getStateInstance () { - return $this->stateInstance; - } - /** * Setter for call-back instance * @@ -787,11 +476,11 @@ abstract class BaseFrameworkSystem extends stdClass implements FrameworkInterfac * @param $str A string (maybe) without trailing slash * @return $str A string with an auto-appended trailing slash */ - public final function addMissingTrailingSlash ($str) { + public final function addMissingTrailingSlash (string $str) { // Is there a trailing slash? if (substr($str, -1, 1) != '/') { $str .= '/'; - } // END - if + } // Return string with trailing slash return $str; @@ -803,7 +492,7 @@ abstract class BaseFrameworkSystem extends stdClass implements FrameworkInterfac * @param $message Optional message to show in debug output * @return void */ - public final function debugInstance ($message = '') { + public final function debugInstance (string $message = '') { // Restore the error handler to avoid trouble with missing array elements or undeclared variables restore_error_handler(); @@ -816,7 +505,7 @@ abstract class BaseFrameworkSystem extends stdClass implements FrameworkInterfac $content = sprintf('
Message: %s
' . PHP_EOL, $message); - } // END - if + } // Generate the output $content .= sprintf('
%s
', @@ -850,7 +539,7 @@ Loaded includes: * @param $str String with control characters * @return $str Replaced string */ - protected function replaceControlCharacters ($str) { + protected function replaceControlCharacters (string $str) { // Replace them $str = str_replace( chr(13), '[r]', str_replace( @@ -869,7 +558,7 @@ Loaded includes: * @param $message An optional message to display * @return void */ - protected function partialStub ($message = '') { + protected function partialStub (string $message = '') { // Init variable $stubMessage = 'Partial stub!'; @@ -877,7 +566,7 @@ Loaded includes: if (!empty($message)) { // Then add it as well $stubMessage .= ' Message: ' . $message; - } // END - if + } // Debug instance is there? if (!is_null($this->getDebugInstance())) { @@ -897,12 +586,12 @@ Loaded includes: * @param $doExit Whether exit the program (true is default) * @return void */ - public function debugBackTrace ($message = '', $doExit = true) { + public function debugBackTrace (string $message = '', bool $doExit = true) { // Sorry, there is no other way getting this nice backtrace if (!empty($message)) { // Output message printf('Message: %s
' . PHP_EOL, $message); - } // END - if + } print('
');
 		debug_print_backtrace();
@@ -911,7 +600,7 @@ Loaded includes:
 		// Exit program?
 		if ($doExit === true) {
 			exit();
-		} // END - if
+		}
 	}
 
 	/**
@@ -922,9 +611,12 @@ Loaded includes:
 	 * @return	$debugInstance	An instance of a debugger class
 	 * @deprecated	Not fully, as the new Logger facilities are not finished yet.
 	 */
-	public final static function createDebugInstance ($className, $lineNumber = NULL) {
-		// Is the instance set?
-		if (!GenericRegistry::getRegistry()->instanceExists('debug')) {
+	public final static function createDebugInstance (string $className, int $lineNumber = NULL) {
+		// Validate parameter
+		if (empty($className)) {
+			// Throw IAE
+			throw new InvalidArgumentException('Parameter "className" is empty');
+		} elseif (!GenericRegistry::getRegistry()->instanceExists('debug')) {
 			// Init debug instance
 			$debugInstance = NULL;
 
@@ -934,7 +626,7 @@ Loaded includes:
 				$debugInstance = DebugMiddleware::createDebugMiddleware(FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('debug_' . FrameworkBootstrap::getRequestTypeFromSystem() . '_class'), $className);
 			} catch (NullPointerException $e) {
 				// Didn't work, no instance there
-				exit(sprintf('Cannot create debugInstance! Exception=%s,message=%s,className=%s,lineNumber=%d' . PHP_EOL, $e->__toString(), $e->getMessage(), $className, $lineNumber));
+				exit(sprintf('[%s:%d]: Cannot create debugInstance! Exception=%s,message=%s,className=%s,lineNumber=%d' . PHP_EOL, __METHOD__, __LINE__, $e->__toString(), $e->getMessage(), $className, $lineNumber));
 			}
 
 			// Empty string should be ignored and used for testing the middleware
@@ -957,7 +649,7 @@ Loaded includes:
 	 * @param	$message	Message to output
 	 * @return	void
 	 */
-	public function outputLine ($message) {
+	public function outputLine (string $message) {
 		// Simply output it
 		print($message . PHP_EOL);
 	}
@@ -972,7 +664,7 @@ Loaded includes:
 	 * @paran	$stripTags	Whether to strip tags (default: false)
 	 * @return	void
 	 */
-	public function debugOutput ($message, $doPrint = true, $stripTags = false) {
+	public function debugOutput (string $message, bool $doPrint = true, bool $stripTags = false) {
 		// Set debug instance to NULL
 		$debugInstance = NULL;
 
@@ -1014,13 +706,13 @@ Loaded includes:
 			if ($doPrint === false) {
 				// Die here if not printed
 				exit();
-			} // END - if
+			}
 		} else {
 			// Are debug times enabled?
 			if (FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('debug_' . FrameworkBootstrap::getRequestTypeFromSystem() . '_output_timings') == 'Y') {
 				// Prepent it
 				$message = $this->getPrintableExecutionTime() . $message;
-			} // END - if
+			}
 
 			// Put directly out
 			if ($doPrint === true) {
@@ -1039,7 +731,7 @@ Loaded includes:
 	 * @param	$phpCode		Unmarked PHP code
 	 * @return	$markedCode		Marked PHP code
 	 */
-	public function markupCode ($phpCode) {
+	public function markupCode (string $phpCode) {
 		// Init marked code
 		$markedCode = '';
 
@@ -1055,7 +747,7 @@ Loaded includes:
 				$errorArray['message'],
 				$errorArray['type']
 			);
-		} // END - if
+		}
 
 		// Add line number to the code
 		foreach (explode(chr(10), $phpCode) as $lineNo => $code) {
@@ -1064,92 +756,26 @@ Loaded includes:
 				($lineNo + 1),
 				htmlentities($code, ENT_QUOTES)
 			);
-		} // END - foreach
+		}
 
 		// Return the code
 		return $markedCode;
 	}
 
-	/**
-	 * Filter a given GMT timestamp (non Uni* stamp!) to make it look more
-	 * beatiful for web-based front-ends. If null is given a message id
-	 * null_timestamp will be resolved and returned.
-	 *
-	 * @param	$timestamp	Timestamp to prepare (filter) for display
-	 * @return	$readable	A readable timestamp
-	 */
-	public function doFilterFormatTimestamp ($timestamp) {
-		// Default value to return
-		$readable = '???';
-
-		// Is the timestamp null?
-		if (is_null($timestamp)) {
-			// Get a message string
-			$readable = $this->getLanguageInstance()->getMessage('null_timestamp');
-		} else {
-			switch ($this->getLanguageInstance()->getLanguageCode()) {
-				case 'de': // German format is a bit different to default
-					// Split the GMT stamp up
-					$dateTime  = explode(' ', $timestamp  );
-					$dateArray = explode('-', $dateTime[0]);
-					$timeArray = explode(':', $dateTime[1]);
-
-					// Construct the timestamp
-					$readable = sprintf(FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('german_date_time'),
-						$dateArray[0],
-						$dateArray[1],
-						$dateArray[2],
-						$timeArray[0],
-						$timeArray[1],
-						$timeArray[2]
-					);
-					break;
-
-				default: // Default is pass-through
-					$readable = $timestamp;
-					break;
-			} // END - switch
-		}
-
-		// Return the stamp
-		return $readable;
-	}
-
-	/**
-	 * Filter a given number into a localized number
-	 *
-	 * @param	$value		The raw value from e.g. database
-	 * @return	$localized	Localized value
-	 */
-	public function doFilterFormatNumber ($value) {
-		// Generate it from config and localize dependencies
-		switch ($this->getLanguageInstance()->getLanguageCode()) {
-			case 'de': // German format is a bit different to default
-				$localized = number_format($value, FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('decimals'), ',', '.');
-				break;
-
-			default: // US, etc.
-				$localized = number_format($value, FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('decimals'), '.', ',');
-				break;
-		} // END - switch
-
-		// Return it
-		return $localized;
-	}
-
 	/**
 	 * "Getter" for databse entry
 	 *
 	 * @return	$entry	An array with database entries
 	 * @throws	NullPointerException	If the database result is not found
 	 * @throws	InvalidDatabaseResultException	If the database result is invalid
+	 * @todo	Monolithic method, should be moved to proper classes
 	 */
 	protected final function getDatabaseEntry () {
 		// Is there an instance?
 		if (!$this->getResultInstance() instanceof SearchableResult) {
 			// Throw an exception here
 			throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER);
-		} // END - if
+		}
 
 		// Rewind it
 		$this->getResultInstance()->rewind();
@@ -1158,7 +784,7 @@ Loaded includes:
 		if ($this->getResultInstance()->valid() === false) {
 			// @TODO Move the constant to e.g. BaseDatabaseResult when there is a non-cached database result available
 			throw new InvalidDatabaseResultException(array($this, $this->getResultInstance()), CachedDatabaseResult::EXCEPTION_INVALID_DATABASE_RESULT);
-		} // END - if
+		}
 
 		// Get next entry
 		$this->getResultInstance()->next();
@@ -1188,7 +814,7 @@ Loaded includes:
 		if (is_null($resultInstance)) {
 			// Then the user instance is no longer valid (expired cookies?)
 			throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER);
-		} // END - if
+		}
 
 		// Get current array
 		$fieldArray = $resultInstance->current();
@@ -1201,12 +827,12 @@ Loaded includes:
 		if ($this->isFieldSet($fieldName)) {
 			// Get it
 			$fieldValue = $fieldArray[$fieldName2];
-		} elseif (defined('DEVELOPER')) {
+		} elseif (FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('developer_mode_enabled')) {
 			// Missing field entry, may require debugging
-			self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']:fieldArray
=' . print_r($fieldArray, true) . '
,fieldName=' . $fieldName . ' not found!'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-FRAMEWORK-SYSTEM: fieldArray
=' . print_r($fieldArray, true) . '
,fieldName=' . $fieldName . ' not found!'); } else { // Missing field entry, may require debugging - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']:fieldName=' . $fieldName . ' not found!'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-FRAMEWORK-SYSTEM: fieldName=' . $fieldName . ' not found!'); } // Return it @@ -1228,7 +854,7 @@ Loaded includes: if (is_null($resultInstance)) { // Then the user instance is no longer valid (expired cookies?) throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER); - } // END - if + } // Get current array $fieldArray = $resultInstance->current(); @@ -1244,28 +870,6 @@ Loaded includes: return $isSet; } - /** - * Flushs all pending updates to the database layer - * - * @return void - */ - public function flushPendingUpdates () { - // Get result instance - $resultInstance = $this->getResultInstance(); - - // Do we have data to update? - if ((is_object($resultInstance)) && ($resultInstance->ifDataNeedsFlush())) { - // Get wrapper class name config entry - $configEntry = $resultInstance->getUpdateInstance()->getWrapperConfigEntry(); - - // Create object instance - $wrapperInstance = DatabaseWrapperFactory::createWrapperByConfiguredName($configEntry); - - // Yes, then send the whole result to the database layer - $wrapperInstance->doUpdateByResult($this->getResultInstance()); - } // END - if - } - /** * Outputs a deprecation warning to the developer. * @@ -1273,9 +877,9 @@ Loaded includes: * @return void * @todo Write a logging mechanism for productive mode */ - public function deprecationWarning ($message) { + public function deprecationWarning (string $message) { // Is developer mode active? - if (defined('DEVELOPER')) { + if (FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('developer_mode_enabled')) { // Debug instance is there? if (!is_null($this->getDebugInstance())) { // Output stub message @@ -1297,7 +901,7 @@ Loaded includes: * @param $phpExtension The PHP extension we shall check * @return $isLoaded Whether the PHP extension is loaded */ - public final function isPhpExtensionLoaded ($phpExtension) { + public final function isPhpExtensionLoaded (string $phpExtension) { // Is it loaded? $isLoaded = in_array($phpExtension, get_loaded_extensions()); @@ -1324,7 +928,7 @@ Loaded includes: * * @return $hasSlept Whether it goes fine */ - public function idle ($milliSeconds) { + public function idle (int $milliSeconds) { // Sleep is fine by default $hasSlept = true; @@ -1353,7 +957,7 @@ Loaded includes: * @param $encodedData Encoded data we shall check * @return $isBase64 Whether the encoded data is Base64 */ - protected function isBase64Encoded ($encodedData) { + protected function isBase64Encoded (string $encodedData) { // Determine it $isBase64 = (@base64_decode($encodedData, true) !== false); @@ -1361,26 +965,6 @@ Loaded includes: return $isBase64; } - /** - * Gets a cache key from Criteria instance - * - * @param $criteriaInstance An instance of a Criteria class - * @param $onlyKeys Only use these keys for a cache key - * @return $cacheKey A cache key suitable for lookup/storage purposes - */ - protected function getCacheKeyByCriteria (Criteria $criteriaInstance, array $onlyKeys = array()) { - // Generate it - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-FRAMEWORK-SYSTEM: criteriaInstance=' . $criteriaInstance->__toString() . ',onlyKeys()=' . count($onlyKeys) . ' - CALLED!'); - $cacheKey = sprintf('%s@%s', - $this->__toString(), - $criteriaInstance->getCacheKey($onlyKeys) - ); - - // And return it - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-FRAMEWORK-SYSTEM: cacheKey=' . $cacheKey . ' - EXIT!'); - return $cacheKey; - } - /** * Getter for startup time in miliseconds * @@ -1396,97 +980,13 @@ Loaded includes: * @return $executionTime Current execution time in nice braces */ protected function getPrintableExecutionTime () { - // Caculate the execution time - $executionTime = microtime(true) - $this->getStartupTime(); - - // Pack it in nice braces - $executionTime = sprintf('[ %01.5f ] ', $executionTime); + // Calculate execution time and pack it in nice braces + $executionTime = sprintf('[ %01.5f ] ', (microtime(true) - $this->getStartupTime())); // And return it return $executionTime; } - /** - * Hashes a given string with a simple but stronger hash function (no salt) - * and hex-encode it. - * - * @param $str The string to be hashed - * @return $hash The hash from string $str - */ - public static final function hash ($str) { - // Hash given string with (better secure) hasher - $hash = bin2hex(mhash(MHASH_SHA256, $str)); - - // Return it - return $hash; - } - - /** - * "Getter" for length of hash() output. This will be "cached" to speed up - * things. - * - * @return $length Length of hash() output - */ - public static final function getHashLength () { - // Is it cashed? - if (is_null(self::$hashLength)) { - // No, then hash a string and save its length. - self::$hashLength = strlen(self::hash('abc123')); - } // END - if - - // Return it - return self::$hashLength; - } - - /** - * Checks whether the given number is really a number (only chars 0-9). - * - * @param $num A string consisting only chars between 0 and 9 - * @param $castValue Whether to cast the value to double. Do only use this to secure numbers from Requestable classes. - * @param $assertMismatch Whether to assert mismatches - * @return $ret The (hopefully) secured numbered value - */ - public function bigintval ($num, $castValue = true, $assertMismatch = false) { - // Filter all numbers out - $ret = preg_replace('/[^0123456789]/', '', $num); - - // Shall we cast? - if ($castValue === true) { - // Cast to biggest numeric type - $ret = (double) $ret; - } // END - if - - // Assert only if requested - if ($assertMismatch === true) { - // Has the whole value changed? - assert(('' . $ret . '' != '' . $num . '') && (!is_null($num))); - } // END - if - - // Return result - return $ret; - } - - /** - * Checks whether the given hexadecimal number is really a hex-number (only chars 0-9,a-f). - * - * @param $num A string consisting only chars between 0 and 9 - * @param $assertMismatch Whether to assert mismatches - * @return $ret The (hopefully) secured hext-numbered value - */ - public function hexval ($num, $assertMismatch = false) { - // Filter all numbers out - $ret = preg_replace('/[^0123456789abcdefABCDEF]/', '', $num); - - // Assert only if requested - if ($assertMismatch === true) { - // Has the whole value changed? - assert(('' . $ret . '' != '' . $num . '') && (!is_null($num))); - } // END - if - - // Return result - return $ret; - } - /** * Determines if an element is set in the generic array * @@ -1496,11 +996,9 @@ Loaded includes: * @param $element Element to check * @return $isset Whether the given key is set */ - protected final function isGenericArrayElementSet ($keyGroup, $subGroup, $key, $element) { - // Debug message - //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key . ',element=' . $element); - + protected final function isGenericArrayElementSet (string $keyGroup, string $subGroup, $key, $element) { // Is it there? + //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key . ',element=' . $element); $isset = isset($this->genericArray[$keyGroup][$subGroup][$key][$element]); // Return it @@ -1514,11 +1012,9 @@ Loaded includes: * @param $key Key to check * @return $isset Whether the given key is set */ - protected final function isGenericArrayKeySet ($keyGroup, $subGroup, $key) { - // Debug message - //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key); - + protected final function isGenericArrayKeySet (string $keyGroup, string $subGroup, $key) { // Is it there? + //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key); $isset = isset($this->genericArray[$keyGroup][$subGroup][$key]); // Return it @@ -1533,11 +1029,9 @@ Loaded includes: * @param $subGroup Sub group * @return $isset Whether the given group is set */ - protected final function isGenericArrayGroupSet ($keyGroup, $subGroup) { - // Debug message - //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup); - + protected final function isGenericArrayGroupSet (string $keyGroup, string $subGroup) { // Is it there? + //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup); $isset = isset($this->genericArray[$keyGroup][$subGroup]); // Return it @@ -1551,18 +1045,16 @@ Loaded includes: * @param $subGroup Sub key group * @return $array An array with all array elements */ - protected final function getGenericSubArray ($keyGroup, $subGroup) { + protected final function getGenericSubArray (string $keyGroup, string $subGroup) { // Is it there? if (!$this->isGenericArrayGroupSet($keyGroup, $subGroup)) { // No, then abort here trigger_error(__METHOD__ . ': keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ' not found.'); exit; - } // END - if - - // Debug message - //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',value=' . print_r($this->genericArray[$keyGroup][$subGroup], true)); + } // Return it + //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',value=' . print_r($this->genericArray[$keyGroup][$subGroup], true)); return $this->genericArray[$keyGroup][$subGroup]; } @@ -1574,11 +1066,9 @@ Loaded includes: * @param $key Key to unset * @return void */ - protected final function unsetGenericArrayKey ($keyGroup, $subGroup, $key) { - // Debug message - //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key); - + protected final function unsetGenericArrayKey (string $keyGroup, string $subGroup, $key) { // Remove it + //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key); unset($this->genericArray[$keyGroup][$subGroup][$key]); } @@ -1591,7 +1081,7 @@ Loaded includes: * @param $element Element to unset * @return void */ - protected final function unsetGenericArrayElement ($keyGroup, $subGroup, $key, $element) { + protected final function unsetGenericArrayElement (string $keyGroup, string $subGroup, $key, $element) { // Debug message //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key . ',element=' . $element); @@ -1608,7 +1098,7 @@ Loaded includes: * @param $value Value to add/append * @return void */ - protected final function appendStringToGenericArrayKey ($keyGroup, $subGroup, $key, $value, $appendGlue = '') { + protected final function appendStringToGenericArrayKey (string $keyGroup, string $subGroup, $key, string $value, $appendGlue = '') { // Debug message //* NOISY-DEBUG: */ if (!is_object($value)) $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key . ',value[' . gettype($value) . ']=' . print_r($value, true) . ',appendGlue=' . $appendGlue); @@ -1632,7 +1122,7 @@ Loaded includes: * @param $value Value to add/append * @return void */ - protected final function appendStringToGenericArrayElement ($keyGroup, $subGroup, $key, $element, $value, $appendGlue = '') { + protected final function appendStringToGenericArrayElement (string $keyGroup, string $subGroup, $key, $element, $value, $appendGlue = '') { // Debug message //* NOISY-DEBUG: */ if (!is_object($value)) $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key . ',element=' . $element . ',value[' . gettype($value) . ']=' . print_r($value, true) . ',appendGlue=' . $appendGlue); @@ -1656,7 +1146,7 @@ Loaded includes: * @param $value Value to add/append * @return void */ - protected final function setStringGenericArrayElement ($keyGroup, $subGroup, $key, $element, $value, $appendGlue = '') { + protected final function setStringGenericArrayElement (string $keyGroup, string $subGroup, $key, $element, $value, $appendGlue = '') { // Debug message //* NOISY-DEBUG: */ if (!is_object($value)) $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key . ',element=' . $element . ',value[' . gettype($value) . ']=' . print_r($value, true) . ',appendGlue=' . $appendGlue); @@ -1673,7 +1163,7 @@ Loaded includes: * @param $forceInit Optionally force initialization * @return void */ - protected final function initGenericArrayGroup ($keyGroup, $subGroup, $forceInit = false) { + protected final function initGenericArrayGroup (string $keyGroup, string $subGroup, bool $forceInit = false) { // Debug message //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',forceInit=' . intval($forceInit)); @@ -1682,10 +1172,10 @@ Loaded includes: // Already initialized trigger_error(__METHOD__ . ':keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ' already initialized.'); exit; - } // END - if + } // Initialize it - $this->genericArray[$keyGroup][$subGroup] = array(); + $this->genericArray[$keyGroup][$subGroup] = []; } /** @@ -1697,7 +1187,7 @@ Loaded includes: * @param $forceInit Optionally force initialization * @return void */ - protected final function initGenericArrayKey ($keyGroup, $subGroup, $key, $forceInit = false) { + protected final function initGenericArrayKey (string $keyGroup, string $subGroup, $key, bool $forceInit = false) { // Debug message //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key . ',forceInit=' . intval($forceInit)); @@ -1706,10 +1196,10 @@ Loaded includes: // Already initialized trigger_error(__METHOD__ . ':keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key . ' already initialized.'); exit; - } // END - if + } // Initialize it - $this->genericArray[$keyGroup][$subGroup][$key] = array(); + $this->genericArray[$keyGroup][$subGroup][$key] = []; } /** @@ -1722,7 +1212,7 @@ Loaded includes: * @param $forceInit Optionally force initialization * @return void */ - protected final function initGenericArrayElement ($keyGroup, $subGroup, $key, $element, $forceInit = false) { + protected final function initGenericArrayElement (string $keyGroup, string $subGroup, $key, $element, bool $forceInit = false) { // Debug message //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key . ',element=' . $element . ',forceInit=' . intval($forceInit)); @@ -1731,10 +1221,10 @@ Loaded includes: // Already initialized trigger_error(__METHOD__ . ':keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key . ',element=' . $element . ' already initialized.'); exit; - } // END - if + } // Initialize it - $this->genericArray[$keyGroup][$subGroup][$key][$element] = array(); + $this->genericArray[$keyGroup][$subGroup][$key][$element] = []; } /** @@ -1746,7 +1236,7 @@ Loaded includes: * @param $value Value to add/append * @return $count Number of array elements */ - protected final function pushValueToGenericArrayKey ($keyGroup, $subGroup, $key, $value) { + protected final function pushValueToGenericArrayKey (string $keyGroup, string $subGroup, $key, $value) { // Debug message //* NOISY-DEBUG: */ if (!is_object($value)) $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key . ',value[' . gettype($value) . ']=' . print_r($value, true)); @@ -1754,7 +1244,7 @@ Loaded includes: if (!$this->isGenericArrayKeySet($keyGroup, $subGroup, $key)) { // Initialize array $this->initGenericArrayKey($keyGroup, $subGroup, $key); - } // END - if + } // Then push it $count = array_push($this->genericArray[$keyGroup][$subGroup][$key], $value); @@ -1775,7 +1265,7 @@ Loaded includes: * @param $value Value to add/append * @return $count Number of array elements */ - protected final function pushValueToGenericArrayElement ($keyGroup, $subGroup, $key, $element, $value) { + protected final function pushValueToGenericArrayElement (string $keyGroup, string $subGroup, $key, $element, $value) { // Debug message //* NOISY-DEBUG: */ if (!is_object($value)) $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key . ',element=' . $element . ',value[' . gettype($value) . ']=' . print_r($value, true)); @@ -1783,7 +1273,7 @@ Loaded includes: if (!$this->isGenericArrayElementSet($keyGroup, $subGroup, $key, $element)) { // Initialize array $this->initGenericArrayElement($keyGroup, $subGroup, $key, $element); - } // END - if + } // Then push it $count = array_push($this->genericArray[$keyGroup][$subGroup][$key][$element], $value); @@ -1802,7 +1292,7 @@ Loaded includes: * @param $key Key to unset * @return $value Last "popped" value */ - protected final function popGenericArrayElement ($keyGroup, $subGroup, $key) { + protected final function popGenericArrayElement (string $keyGroup, string $subGroup, $key) { // Debug message //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key); @@ -1811,7 +1301,7 @@ Loaded includes: // Not found trigger_error(__METHOD__ . ': keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key . ' not found.'); exit; - } // END - if + } // Then "pop" it $value = array_pop($this->genericArray[$keyGroup][$subGroup][$key]); @@ -1830,7 +1320,7 @@ Loaded includes: * @param $key Key to unset * @return $value Last "popped" value */ - protected final function shiftGenericArrayElement ($keyGroup, $subGroup, $key) { + protected final function shiftGenericArrayElement (string $keyGroup, string $subGroup, $key) { // Debug message //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key); @@ -1839,7 +1329,7 @@ Loaded includes: // Not found trigger_error(__METHOD__ . ': keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key . ' not found.'); exit; - } // END - if + } // Then "shift" it $value = array_shift($this->genericArray[$keyGroup][$subGroup][$key]); @@ -1865,7 +1355,7 @@ Loaded includes: // Abort here trigger_error(__METHOD__ . ': keyGroup=' . $keyGroup . ' not found.'); exit; - } // END - if + } // Then count it $count = count($this->genericArray[$keyGroup]); @@ -1884,7 +1374,7 @@ Loaded includes: * @param $subGroup Sub group for the key * @return $count Count of given group */ - protected final function countGenericArrayGroup ($keyGroup, $subGroup) { + protected final function countGenericArrayGroup (string $keyGroup, string $subGroup) { // Debug message //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup); @@ -1893,7 +1383,7 @@ Loaded includes: // Abort here trigger_error(__METHOD__ . ': keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ' not found.'); exit; - } // END - if + } // Then count it $count = count($this->genericArray[$keyGroup][$subGroup]); @@ -1913,7 +1403,7 @@ Loaded includes: * @para $key Key to count * @return $count Count of given key */ - protected final function countGenericArrayElements ($keyGroup, $subGroup, $key) { + protected final function countGenericArrayElements (string $keyGroup, string $subGroup, $key) { // Debug message //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key); @@ -1953,7 +1443,7 @@ Loaded includes: // Then abort here trigger_error(__METHOD__ . ': keyGroup=' . $keyGroup . ' does not exist.'); exit; - } // END - if + } // Return it return $this->genericArray[$keyGroup]; @@ -1968,7 +1458,7 @@ Loaded includes: * @param $value Mixed value from generic array element * @return void */ - protected final function setGenericArrayKey ($keyGroup, $subGroup, $key, $value) { + protected final function setGenericArrayKey (string $keyGroup, string $subGroup, $key, $value) { // Debug message //* NOISY-DEBUG: */ if (!is_object($value)) $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key . ',value[' . gettype($value) . ']=' . print_r($value, true)); @@ -1984,7 +1474,7 @@ Loaded includes: * @param $key Key to unset * @return $value Mixed value from generic array element */ - protected final function getGenericArrayKey ($keyGroup, $subGroup, $key) { + protected final function getGenericArrayKey (string $keyGroup, string $subGroup, $key) { // Debug message //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key); @@ -1993,7 +1483,7 @@ Loaded includes: // Then abort here trigger_error(__METHOD__ . ': keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key . ' does not exist.'); exit; - } // END - if + } // Return it return $this->genericArray[$keyGroup][$subGroup][$key]; @@ -2009,7 +1499,7 @@ Loaded includes: * @param $value Value to set * @return void */ - protected final function setGenericArrayElement ($keyGroup, $subGroup, $key, $element, $value) { + protected final function setGenericArrayElement (string $keyGroup, string $subGroup, $key, $element, $value) { // Debug message //* NOISY-DEBUG: */ if (!is_object($value)) $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key . ',element=' . $element . ',value[' . gettype($value) . ']=' . print_r($value, true)); @@ -2026,7 +1516,7 @@ Loaded includes: * @param $element Element to look for * @return $value Mixed value from generic array element */ - protected final function getGenericArrayElement ($keyGroup, $subGroup, $key, $element) { + protected final function getGenericArrayElement (string $keyGroup, string $subGroup, $key, $element) { // Debug message //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key . ',element=' . $element); @@ -2035,7 +1525,7 @@ Loaded includes: // Then abort here trigger_error(__METHOD__ . ': keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key . ',element=' . $element . ' does not exist.'); exit; - } // END - if + } // Return it return $this->genericArray[$keyGroup][$subGroup][$key][$element]; @@ -2048,7 +1538,7 @@ Loaded includes: * @param $subGroup Sub group for the key * @return $isValid Whether given sub group is valid */ - protected final function isValidGenericArrayGroup ($keyGroup, $subGroup) { + protected final function isValidGenericArrayGroup (string $keyGroup, string $subGroup) { // Debug message //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup); @@ -2067,7 +1557,7 @@ Loaded includes: * @param $key Key to check * @return $isValid Whether given sub group is valid */ - protected final function isValidGenericArrayKey ($keyGroup, $subGroup, $key) { + protected final function isValidGenericArrayKey (string $keyGroup, string $subGroup, $key) { // Debug message //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key); @@ -2084,11 +1574,8 @@ Loaded includes: * @return void */ protected function initWebOutputInstance () { - // Get application instance - $applicationInstance = GenericRegistry::getRegistry()->getInstance('application'); - // Init web output instance - $outputInstance = ObjectFactory::createObjectByConfiguredName('output_class', array($applicationInstance)); + $outputInstance = ObjectFactory::createObjectByConfiguredName('output_class'); // Set it locally $this->setWebOutputInstance($outputInstance); @@ -2128,7 +1615,7 @@ Loaded includes: if (!is_writable($basePath)) { // Path is write-protected throw new PathWriteProtectedException($infoInstance, self::EXCEPTION_PATH_CANNOT_BE_WRITTEN); - } // END - if + } // Add it $tempInstance = new SplFileInfo($basePath . DIRECTORY_SEPARATOR . $infoInstance->getBasename()); @@ -2137,7 +1624,7 @@ Loaded includes: if (!FrameworkBootstrap::isReachableFilePath($tempInstance)) { // Not reachable throw new FileIoException($tempInstance, self::EXCEPTION_FILE_NOT_REACHABLE); - } // END - if + } // Return it return $tempInstance; @@ -2147,6 +1634,7 @@ Loaded includes: * "Getter" for a printable state name * * @return $stateName Name of the node's state in a printable format + * @todo Move this class away from this monolithic place (not whole class is monolithic) */ public final function getPrintableState () { // Default is 'null' @@ -2159,7 +1647,7 @@ Loaded includes: if ($stateInstance instanceof Stateable) { // Then use that state name $stateName = $stateInstance->getStateName(); - } // END - if + } // Return result return $stateName;