X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=framework%2Fmain%2Fclasses%2Fclass_BaseFrameworkSystem.php;h=49d58164104e88d0af315cba048df16d05a3844e;hb=2218902056efcf9a2c66fe7c24995e066bd7cd11;hp=6280c51517baf79ba8460022e22ec6aa36cb887d;hpb=00571e55f7ea67ec80e36a3a293b0b7162c83572;p=core.git diff --git a/framework/main/classes/class_BaseFrameworkSystem.php b/framework/main/classes/class_BaseFrameworkSystem.php index 6280c515..49d58164 100644 --- a/framework/main/classes/class_BaseFrameworkSystem.php +++ b/framework/main/classes/class_BaseFrameworkSystem.php @@ -6,11 +6,12 @@ namespace Org\Mxchange\CoreFramework\Object; use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap; use Org\Mxchange\CoreFramework\Criteria\Criteria; use Org\Mxchange\CoreFramework\EntryPoint\ApplicationEntryPoint; -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\Helper\Application\ApplicationHelper; use Org\Mxchange\CoreFramework\Loader\ClassLoader; use Org\Mxchange\CoreFramework\Manager\ManageableApplication; use Org\Mxchange\CoreFramework\Middleware\Debug\DebugMiddleware; @@ -497,7 +498,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(); @@ -544,7 +545,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( @@ -563,7 +564,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!'; @@ -591,7 +592,7 @@ 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 @@ -616,7 +617,7 @@ 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) { + public final static function createDebugInstance (string $className, int $lineNumber = NULL) { // Is the instance set? if (!GenericRegistry::getRegistry()->instanceExists('debug')) { // Init debug instance @@ -651,7 +652,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); } @@ -666,7 +667,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; @@ -733,7 +734,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 = ''; @@ -831,10 +832,10 @@ Loaded includes: $fieldValue = $fieldArray[$fieldName2]; } 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 @@ -879,7 +880,7 @@ 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 (FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('developer_mode_enabled')) { // Debug instance is there? @@ -903,7 +904,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()); @@ -930,7 +931,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; @@ -959,7 +960,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); @@ -1002,11 +1003,8 @@ 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; @@ -1019,7 +1017,7 @@ Loaded includes: * @param $str The string to be hashed * @return $hash The hash from string $str */ - public static final function hash ($str) { + public static final function hash (string $str) { // Hash given string with (better secure) hasher $hash = bin2hex(mhash(MHASH_SHA256, $str)); @@ -1642,7 +1640,7 @@ Loaded includes: */ protected function initWebOutputInstance () { // Get application instance - $applicationInstance = GenericRegistry::getRegistry()->getInstance('application'); + $applicationInstance = ApplicationHelper::getSelfInstance(); // Init web output instance $outputInstance = ObjectFactory::createObjectByConfiguredName('output_class', array($applicationInstance));