Skip to content

Commit cdb8c83

Browse files
committed
Hide empty tabs
1 parent 20afe93 commit cdb8c83

File tree

6 files changed

+20
-1
lines changed

6 files changed

+20
-1
lines changed

src/DataCollector/CacheCollector.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@ public function collect()
7070
$data = parent::collect();
7171
$data['nb_measures'] = count($data['measures']);
7272

73+
if (! $data['nb_measures']) {
74+
return [];
75+
}
76+
7377
return $data;
7478
}
7579

src/DataCollector/EventCollector.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,10 @@ public function collect()
9999
$data = parent::collect();
100100
$data['nb_measures'] = count($data['measures']);
101101

102+
if (! $data['nb_measures']) {
103+
return [];
104+
}
105+
102106
return $data;
103107
}
104108

src/DataCollector/QueryCollector.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -584,6 +584,11 @@ public function collect()
584584
}
585585

586586
$visibleStatements = count($statements) - $this->infoStatements;
587+
588+
if (! $visibleStatements) {
589+
return [];
590+
}
591+
587592
$data = [
588593
'nb_statements' => $this->queryCount,
589594
'nb_visible_statements' => $visibleStatements,

src/DataCollector/ViewCollector.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,10 @@ public function collect()
201201
$templates = $this->templates;
202202
}
203203

204+
if (empty($this->templates)) {
205+
return [];
206+
}
207+
204208
return [
205209
'nb_templates' => count($this->templates),
206210
'templates' => $templates,

tests/DebugbarBrowserTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ protected function getEnvironmentSetUp($app)
2323

2424
$app['env'] = 'local';
2525

26-
// $app['config']->set('app.debug', true);
26+
//$app['config']->set('app.debug', true);
27+
$app['config']['config']->set('debugbar.hide_empty_tabs', false);
2728

2829
/** @var Router $router */
2930
$router = $app['router'];

tests/TestCase.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ protected function getEnvironmentSetUp($app)
4747
{
4848
/** @var Router $router */
4949
$router = $app['router'];
50+
$app['config']->set('debugbar.hide_empty_tabs', false);
5051

5152
$this->addWebRoutes($router);
5253
$this->addApiRoutes($router);

0 commit comments

Comments
 (0)