X-Git-Url: https://git.mxchange.org/?p=core.git;a=blobdiff_plain;f=framework%2Fmain%2Fclasses%2Foutput%2Fdebug%2Fconsole%2Fclass_DebugConsoleOutput.php;h=140365da8eaf583512d146aff1fdf5a7e27b443f;hp=80915da609e0e012dfa4bbf2048d2796bbc7159c;hb=HEAD;hpb=53bf33122fffeedc46ea50c84cbbdd9e2aabd45d diff --git a/framework/main/classes/output/debug/console/class_DebugConsoleOutput.php b/framework/main/classes/output/debug/console/class_DebugConsoleOutput.php index 80915da6..140365da 100644 --- a/framework/main/classes/output/debug/console/class_DebugConsoleOutput.php +++ b/framework/main/classes/output/debug/console/class_DebugConsoleOutput.php @@ -5,6 +5,7 @@ namespace Org\Mxchange\CoreFramework\Debug\Output; // Import framework stuff use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap; use Org\Mxchange\CoreFramework\Debug\Debugger; +use Org\Mxchange\CoreFramework\Generic\FrameworkInterface; use Org\Mxchange\CoreFramework\Generic\UnsupportedOperationException; use Org\Mxchange\CoreFramework\Output\Debug\BaseDebugOutput; use Org\Mxchange\CoreFramework\Registry\Registerable; @@ -15,7 +16,7 @@ use Org\Mxchange\CoreFramework\Stream\Output\OutputStreamer; * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2021 Core Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2023 Core Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.shipsimu.org * @@ -33,14 +34,22 @@ use Org\Mxchange\CoreFramework\Stream\Output\OutputStreamer; * along with this program. If not, see . */ class DebugConsoleOutput extends BaseDebugOutput implements Debugger, OutputStreamer, Registerable { + /** + * Cached configuration entry 'debug_*_output_timings' + */ + private $isDebugOutputTimingsEnabled = FALSE; + /** * Protected constructor * * @return void */ private function __construct () { - // Call parent constructor + // Call parent constructor first parent::__construct(__CLASS__); + + // Cache configuration entry + $this->isDebugOutputTimingsEnabled = FrameworkBootstrap::getConfigurationInstance()->isEnabled('debug_' . FrameworkBootstrap::getRequestTypeFromSystem() . '_output_timings'); } /** @@ -71,7 +80,7 @@ class DebugConsoleOutput extends BaseDebugOutput implements Debugger, OutputStre } // Are debug times enabled? - if (FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('debug_' . FrameworkBootstrap::getRequestTypeFromSystem() . '_output_timings') == 'Y') { + if ($this->isDebugOutputTimingsEnabled) { // Output it first $output = $this->getPrintableExecutionTime() . $output; } @@ -103,7 +112,7 @@ class DebugConsoleOutput extends BaseDebugOutput implements Debugger, OutputStre */ public function streamData (string $data) { self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('Unhandled ' . strlen($data) . ' bytes in this stream.'); - throw new UnsupportedOperationException(array($this, __FUNCTION__), self::EXCEPTION_UNSPPORTED_OPERATION); + throw new UnsupportedOperationException([$this, __FUNCTION__], FrameworkInterface::EXCEPTION_UNSPPORTED_OPERATION); } }