improve code
Dieser Commit ist enthalten in:
Ursprung
a3b0050922
Commit
f097a58691
@ -22,6 +22,7 @@ use DebugBar\Bridge\MonologCollector;
|
||||
use DebugBar\DebugBarException;
|
||||
use DebugBar\JavascriptRenderer;
|
||||
use DebugBar\StandardDebugBar;
|
||||
use Doctrine\DBAL\Connection;
|
||||
use Doctrine\DBAL\Logging\DebugStack;
|
||||
use Monolog\Logger;
|
||||
use OxidEsales\Eshop\Core\Controller\BaseController;
|
||||
@ -85,6 +86,7 @@ class DebugBarComponent extends BaseController
|
||||
{
|
||||
$db = DatabaseProvider::getDb();
|
||||
$debugStack = new DebugStack();
|
||||
/** @var Connection $connection */
|
||||
$connection = $this->getNonPublicProperty($db, 'connection');
|
||||
$connection->getConfiguration()->setSQLLogger($debugStack);
|
||||
return new DoctrineCollector($debugStack);
|
||||
@ -100,12 +102,13 @@ class DebugBarComponent extends BaseController
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $object
|
||||
* @param $propName
|
||||
* @param object $object
|
||||
* @param string $propName
|
||||
*
|
||||
* @return mixed
|
||||
* @throws ReflectionException
|
||||
*/
|
||||
protected function getNonPublicProperty($object, $propName)
|
||||
protected function getNonPublicProperty(object $object, string $propName)
|
||||
{
|
||||
$reflection = new ReflectionClass($object);
|
||||
$property = $reflection->getProperty($propName);
|
||||
|
@ -16,6 +16,7 @@ declare(strict_types=1);
|
||||
namespace D3\DebugBar\Modules\Core;
|
||||
|
||||
use D3\DebugBar\Application\Component\DebugBarComponent;
|
||||
use OxidEsales\Eshop\Application\Controller\FrontendController;
|
||||
use OxidEsales\Eshop\Core\Registry;
|
||||
|
||||
class ShopControl_DebugBar extends ShopControl_DebugBar_parent
|
||||
@ -49,11 +50,11 @@ class ShopControl_DebugBar extends ShopControl_DebugBar_parent
|
||||
public function __destruct()
|
||||
{
|
||||
if (!isAdmin()) {
|
||||
/** @var DebugBarComponent $debugBarComponent */
|
||||
/** @var FrontendController $activeView */
|
||||
$activeView = Registry::getConfig()->getTopActiveView();
|
||||
if ($activeView &&
|
||||
$debugBarComponent = $activeView->getComponent(DebugBarComponent::class)
|
||||
) {
|
||||
/** @var DebugBarComponent|null $debugBarComponent */
|
||||
$debugBarComponent = $activeView->getComponent(DebugBarComponent::class);
|
||||
if ($debugBarComponent) {
|
||||
echo $debugBarComponent->getRenderer()->renderHead();
|
||||
$debugBarComponent->addTimelineMessures();
|
||||
echo $debugBarComponent->getRenderer()->render();
|
||||
|
@ -16,9 +16,14 @@ declare(strict_types=1);
|
||||
use D3\DebugBar\Application\Component\DebugBarComponent;
|
||||
use D3\DebugBar\Application\Models\TimeDataCollectorHandler;
|
||||
use DebugBar\DataCollector\MessagesCollector;
|
||||
use DebugBar\DebugBarException;
|
||||
use OxidEsales\Eshop\Core\Registry;
|
||||
|
||||
function startProfile($sProfileName)
|
||||
/**
|
||||
* @param $sProfileName
|
||||
* @return void
|
||||
*/
|
||||
function startProfile(string $sProfileName): void
|
||||
{
|
||||
$trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
|
||||
$trace[0] = $sProfileName;
|
||||
@ -39,7 +44,13 @@ function startProfile($sProfileName)
|
||||
$aStartTimes[$sProfileName] = microtime(true);
|
||||
}
|
||||
|
||||
function stopProfile($sProfileName)
|
||||
/**
|
||||
* @param string $sProfileName
|
||||
*
|
||||
* @return void
|
||||
* @throws DebugBarException
|
||||
*/
|
||||
function stopProfile(string $sProfileName): void
|
||||
{
|
||||
$trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
|
||||
$trace[0] = $sProfileName;
|
||||
@ -61,13 +72,22 @@ function stopProfile($sProfileName)
|
||||
$aStartTimes[$sProfileName] = microtime(true);
|
||||
}
|
||||
|
||||
function debugVar($mVar, $blToFile = false)
|
||||
/**
|
||||
* @param mixed $mVar
|
||||
* @param bool $blToFile
|
||||
*
|
||||
* @throws DebugBarException
|
||||
* @return void
|
||||
*/
|
||||
function debugVar($mVar, bool $blToFile = false): void
|
||||
{
|
||||
if ($blToFile) {
|
||||
$out = var_export($mVar, true);
|
||||
$f = fopen(Registry::getConfig()->getConfigParam('sCompileDir') . "/vardump.txt", "a");
|
||||
fwrite($f, $out);
|
||||
fclose($f);
|
||||
if (is_resource($f)) {
|
||||
fwrite( $f, $out );
|
||||
fclose( $f );
|
||||
}
|
||||
} else {
|
||||
if (!isAdmin()) {
|
||||
$activeView = Registry::getConfig()->getTopActiveView();
|
||||
|
@ -1,9 +1,12 @@
|
||||
parameters:
|
||||
paths:
|
||||
- .
|
||||
scanFiles:
|
||||
- IntelliSenseHelper.php
|
||||
- ../../oxid-esales/oxideshop-ce/source/oxfunctions.php
|
||||
level: 9
|
||||
phpVersion: 70100
|
||||
phpVersion: 70300
|
||||
checkMissingIterableValueType: false
|
||||
ignoreErrors:
|
||||
- '#Psr\\Container\\ContainerExceptionInterface is not subtype of Throwable#'
|
||||
- '#setConfigParam\(\) expects string, array given.#'
|
||||
- '#Offset .* does not exist on array{function: .*}.#'
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren