Skip to content

Commit

Permalink
Apply fixes from StyleCI
Browse files Browse the repository at this point in the history
  • Loading branch information
abbadon1334 authored and StyleCIBot committed Sep 11, 2019
1 parent fcd4c31 commit 53dcf27
Showing 1 changed file with 19 additions and 21 deletions.
40 changes: 19 additions & 21 deletions src/DebugBar.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
use atk4\core\FactoryTrait;
use atk4\core\InitializerTrait;
use atk4\data\Persistence;
use atk4\ui\Exception;
use ATK4PHPDebugBar\Bridge\ATK4Collector;
use ATK4PHPDebugBar\Collector\ATK4Logger;
use DebugBar\DataCollector\DataCollectorInterface;
use DebugBar\DataCollector\ExceptionsCollector;
Expand Down Expand Up @@ -46,7 +44,7 @@ class DebugBar
/**
* @var string
*/
protected $assets_resources_path = 'vendor' . DIRECTORY_SEPARATOR . 'maximebf' . DIRECTORY_SEPARATOR . 'debugbar' . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR . 'DebugBar' . DIRECTORY_SEPARATOR . 'Resources' . DIRECTORY_SEPARATOR;
protected $assets_resources_path = 'vendor'.DIRECTORY_SEPARATOR.'maximebf'.DIRECTORY_SEPARATOR.'debugbar'.DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR.'DebugBar'.DIRECTORY_SEPARATOR.'Resources'.DIRECTORY_SEPARATOR;

/** @var TimeDataCollector */
protected $timeDataCollector;
Expand All @@ -61,7 +59,7 @@ public function init(): void

$this->timeDataCollector = new TimeDataCollector();

$this->debugBar = new \DebugBar\DebugBar();
$this->debugBar = new \DebugBar\DebugBar();
$this->debugBarRenderer = $this->debugBar->getJavascriptRenderer();

$this->addCollector(new MessagesCollector());
Expand All @@ -86,40 +84,40 @@ protected function setUpApp(): void
{
$this->app->addHook(
'beforeRender', function ($j): void {
$this->processAssets();
}
$this->processAssets();
}
);

$this->app->addHook(
'beforeOutput', function ($j): void {
$this->app->html->template->appendHTML('Content', $this->debugBarRenderer->render());
}
$this->app->html->template->appendHTML('Content', $this->debugBarRenderer->render());
}
);

$this->app->addHook(
'beforeExit', function ($j): void {
if (!headers_sent()) {
$this->debugBar->sendDataInHeaders(false);
if (! headers_sent()) {
$this->debugBar->sendDataInHeaders(false);
}
}
}
);

$this->app->addMethod(
'getDebugBar', function ($app) {
return $this->getDebugBar();
}
return $this->getDebugBar();
}
);

$this->app->addMethod(
'getDebugBarCollector', function ($app, string $name) {
return $this->getCollector($name);
}
return $this->getCollector($name);
}
);

$this->app->addMethod(
'hasDebugBarCollector', function ($app, string $name) {
return $this->hasCollector($name);
}
return $this->hasCollector($name);
}
);
}

Expand All @@ -134,11 +132,11 @@ protected function processAssets()
[$required_css, $required_js] = $this->debugBarRenderer->getAssets(null, '');

foreach ($required_css as $css) {
$this->app->requireCSS($relative_url . $css);
$this->app->requireCSS($relative_url.$css);
}

foreach ($required_js as $js) {
$this->app->requireJS($relative_url . $js);
$this->app->requireJS($relative_url.$js);
}
}

Expand Down Expand Up @@ -205,7 +203,7 @@ public function addDefaultCollectors(): void
$this->addCollector(new MemoryCollector());
$this->addCollector(new ExceptionsCollector());

if (!$this->hasCollector($this->timeDataCollector->getName())) {
if (! $this->hasCollector($this->timeDataCollector->getName())) {
$this->addCollector($this->timeDataCollector);
}
}
Expand All @@ -230,7 +228,7 @@ public function addATK4PersistenceSQLCollector(?Persistence\SQL $persistence = n
$pdo = new TraceablePDO($persistence->connection->connection());
$this->addCollector(new PDOCollector($pdo, $this->timeDataCollector));

if (!$this->hasCollector($this->timeDataCollector->getName())) {
if (! $this->hasCollector($this->timeDataCollector->getName())) {
$this->addCollector($this->timeDataCollector);
}
}
Expand Down

0 comments on commit 53dcf27

Please sign in to comment.