apply code style rules

This commit is contained in:
Daniel Seifert 2022-08-03 09:17:43 +02:00
parent f097a58691
commit 0d4662edf5
Signed by: DanielS
GPG Key ID: 8A7C4C6ED1915C6F
6 changed files with 72 additions and 69 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.php_cs.cache

View File

@ -22,93 +22,93 @@ use Smarty;
class SmartyCollector extends DataCollector implements Renderable
{
/** @var Smarty */
protected $smarty;
protected $smarty;
/**
* @var bool
*/
protected $useHtmlVarDumper = false;
/**
* @var bool
*/
protected $useHtmlVarDumper = false;
/**
* Sets a flag indicating whether the Symfony HtmlDumper will be used to dump variables for
* rich variable rendering.
*
* @param bool $value
* @return $this
*/
public function useHtmlVarDumper($value = true)
{
$this->useHtmlVarDumper = $value;
/**
* Sets a flag indicating whether the Symfony HtmlDumper will be used to dump variables for
* rich variable rendering.
*
* @param bool $value
* @return $this
*/
public function useHtmlVarDumper($value = true)
{
$this->useHtmlVarDumper = $value;
return $this;
}
return $this;
}
/**
* Indicates whether the Symfony HtmlDumper will be used to dump variables for rich variable
* rendering.
*
* @return mixed
*/
public function isHtmlVarDumperUsed()
{
return $this->useHtmlVarDumper;
}
/**
* Indicates whether the Symfony HtmlDumper will be used to dump variables for rich variable
* rendering.
*
* @return mixed
*/
public function isHtmlVarDumperUsed()
{
return $this->useHtmlVarDumper;
}
/**
* @param Smarty $smarty
*/
public function __construct(Smarty $smarty)
{
$this->smarty = $smarty;
}
public function __construct(Smarty $smarty)
{
$this->smarty = $smarty;
}
/**
* @return array
*/
public function collect(): array
public function collect(): array
{
$data = [];
$data = [];
$vars = $this->smarty->get_template_vars();
foreach ($vars as $idx => $var) {
if ($this->isHtmlVarDumperUsed()) {
$data[$idx] = $this->getVarDumper()->renderVar($var);
} else {
$data[$idx] = $this->getDataFormatter()->formatVar($var);
}
}
foreach ($vars as $idx => $var) {
if ($this->isHtmlVarDumperUsed()) {
$data[$idx] = $this->getVarDumper()->renderVar($var);
} else {
$data[$idx] = $this->getDataFormatter()->formatVar($var);
}
}
return ['vars' => $data, 'count' => count($data)];
}
return ['vars' => $data, 'count' => count($data)];
}
/**
* @return string
*/
public function getName(): string
public function getName(): string
{
return 'smarty';
}
return 'smarty';
}
/**
* @return array
*/
public function getWidgets(): array
public function getWidgets(): array
{
$widget = $this->isHtmlVarDumperUsed()
? "PhpDebugBar.Widgets.HtmlVariableListWidget"
: "PhpDebugBar.Widgets.VariableListWidget";
return array(
"smarty" => array(
"icon" => "tags",
"widget" => $widget,
"map" => "smarty.vars",
"default" => "{}"
),
"smarty:badge" => array(
"map" => "smarty.count",
"default" => 0
)
);
}
$widget = $this->isHtmlVarDumperUsed()
? "PhpDebugBar.Widgets.HtmlVariableListWidget"
: "PhpDebugBar.Widgets.VariableListWidget";
return [
"smarty" => [
"icon" => "tags",
"widget" => $widget,
"map" => "smarty.vars",
"default" => "{}",
],
"smarty:badge" => [
"map" => "smarty.count",
"default" => 0,
],
];
}
}

View File

@ -32,4 +32,4 @@ class TimeDataCollectorHandler
}
return self::$instance;
}
}
}

View File

@ -17,5 +17,7 @@ namespace D3\DebugBar\Modules\Core {
use OxidEsales\Eshop\Core\ShopControl;
class ShopControl_DebugBar_parent extends ShopControl{}
}
class ShopControl_DebugBar_parent extends ShopControl
{
}
}

View File

@ -85,8 +85,8 @@ function debugVar($mVar, bool $blToFile = false): void
$out = var_export($mVar, true);
$f = fopen(Registry::getConfig()->getConfigParam('sCompileDir') . "/vardump.txt", "a");
if (is_resource($f)) {
fwrite( $f, $out );
fclose( $f );
fwrite($f, $out);
fclose($f);
}
} else {
if (!isAdmin()) {
@ -103,4 +103,4 @@ function debugVar($mVar, bool $blToFile = false): void
dumpVar($mVar, $blToFile);
}
}
}
}

View File

@ -37,7 +37,7 @@ $aModule = [
'url' => 'https://www.oxidmodule.com/',
'controllers' => [],
'extend' => [
ShopControl::class => ShopControl_DebugBar::class
ShopControl::class => ShopControl_DebugBar::class,
],
'events' => [],
'templates' => [],