Skip to content

Commit

Permalink
tidy up..
Browse files Browse the repository at this point in the history
  • Loading branch information
rhukster committed Oct 14, 2014
1 parent 2bfcd88 commit bdd0c1f
Showing 1 changed file with 10 additions and 15 deletions.
25 changes: 10 additions & 15 deletions system/src/Grav/Common/Debugger.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@
class Debugger
{
protected $grav;
protected $enabled = false;
protected $timing = false;
protected $twig = false;
protected $debugbar;
protected $renderer;

Expand All @@ -28,21 +25,15 @@ public function init()
{
$config = $this->grav['config'];
if ($config->get('system.debugger.enabled')) {
$this->enabled = true;
$this->debugbar->addCollector(new \DebugBar\DataCollector\ConfigCollector((array)$config->get('system')));
}
if ($config->get('system.debugger.timing')) {
$this->timing = true;
}
if ($config->get('system.debugger.twig')) {
$this->twig = true;
}
return $this;
}

public function addAssets()
{
if ($this->enabled) {
$config = $this->grav['config'];
if ($config->get('system.debugger.enabled')) {

$assets = $this->grav['assets'];

Expand Down Expand Up @@ -75,23 +66,26 @@ public function getCollector($collector)

public function render()
{
if ($this->enabled) {
$config = $this->grav['config'];
if ($config->get('system.debugger.enabled')) {
echo $this->renderer->render();
}
return $this;
}

public function startTimer($name, $desription = null)
{
if ($this->enabled || $name == 'config' || $name == 'debugger') {
$config = $this->grav['config'];
if ($config->get('system.debugger.enabled') || $name == 'config' || $name == 'debugger') {
$this->debugbar['time']->startMeasure($name, $desription);
}
return $this;
}

public function stopTimer($name)
{
if ($this->enabled || $name == 'config' || $name == 'debugger') {
$config = $this->grav['config'];
if ($config->get('system.debugger.enabled') || $name == 'config' || $name == 'debugger') {
$this->debugbar['time']->stopMeasure($name);
}
return $this;
Expand All @@ -100,7 +94,8 @@ public function stopTimer($name)

public function addMessage($message)
{
if ($this->enabled) {
$config = $this->grav['config'];
if ($config->get('system.debugger.enabled')) {
$this->debugbar['messages']->addMessage($message);
}
return $this;
Expand Down

0 comments on commit bdd0c1f

Please sign in to comment.