Skip to content

Commit 0af6e3d

Browse files
committed
[WebProfilerBundle][HttpKernel] Display runner class in the profiler toolbar
1 parent a30f387 commit 0af6e3d

File tree

4 files changed

+40
-0
lines changed

4 files changed

+40
-0
lines changed

src/Symfony/Bundle/WebProfilerBundle/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ CHANGELOG
66

77
* Add support for the `QUERY` HTTP method in the profiler
88
* Add support for Server-Sent Events / `EventSource` requests in the debug toolbar
9+
* Add support for displaying the application runner class
910

1011
7.3
1112
---

src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/config.html.twig

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,13 @@
9292
</span>
9393
</div>
9494

95+
{% if collector.runner is defined and collector.runner is not null %}
96+
<div class="sf-toolbar-info-piece sf-toolbar-info-runner">
97+
<b>Runner</b>
98+
<span>{{ collector.runner|abbr_class }}</span>
99+
</div>
100+
{% endif %}
101+
95102
{% if 'n/a' is not same as(collector.env) %}
96103
<div class="sf-toolbar-info-piece">
97104
<b>Environment</b>
@@ -170,6 +177,15 @@
170177
{% block panel %}
171178
<h2>Symfony Configuration</h2>
172179

180+
{% if collector.runner is defined and collector.runner is not null %}
181+
<div class="metrics">
182+
<div class="metric">
183+
<span class="value">{{ collector.runner|abbr_class }}</span>
184+
<span class="label">Runner</span>
185+
</div>
186+
</div>
187+
{% endif %}
188+
173189
<div class="metrics">
174190
<div class="metric">
175191
<span class="value">

src/Symfony/Component/HttpKernel/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ CHANGELOG
99
* Deprecate implementing `__sleep/wakeup()` on data collectors; use `__(un)serialize()` instead
1010
* Add `#[IsSignatureValid]` attribute to validate URI signatures
1111
* Make `Profile` final and `Profiler::__sleep()` internal
12+
* Collect the application runner class
1213

1314
7.3
1415
---

src/Symfony/Component/HttpKernel/DataCollector/ConfigDataCollector.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use Symfony\Component\HttpFoundation\Response;
1616
use Symfony\Component\HttpKernel\Kernel;
1717
use Symfony\Component\HttpKernel\KernelInterface;
18+
use Symfony\Component\Runtime\RunnerInterface;
1819
use Symfony\Component\VarDumper\Caster\ClassStub;
1920
use Symfony\Component\VarDumper\Cloner\Data;
2021

@@ -64,6 +65,7 @@ public function collect(Request $request, Response $response, ?\Throwable $excep
6465
'zend_opcache_status' => \extension_loaded('Zend OPcache') ? (filter_var(\ini_get('opcache.enable'), \FILTER_VALIDATE_BOOLEAN) ? 'Enabled' : 'Not enabled') : 'Not installed',
6566
'bundles' => [],
6667
'sapi_name' => \PHP_SAPI,
68+
'runner_class' => $this->determineRunnerClass(),
6769
];
6870

6971
if (isset($this->kernel)) {
@@ -249,6 +251,11 @@ public function getSapiName(): string
249251
return $this->data['sapi_name'];
250252
}
251253

254+
public function getRunnerClass(): ?string
255+
{
256+
return $this->data['runner_class'];
257+
}
258+
252259
public function getName(): string
253260
{
254261
return 'config';
@@ -272,4 +279,19 @@ private function determineSymfonyState(): string
272279

273280
return $versionState;
274281
}
282+
283+
private function determineRunnerClass(): ?string
284+
{
285+
$stack = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
286+
for ($frame = end($stack) ; $frame ; $frame = prev($stack)) {
287+
if (!$class = $frame['class'] ?? null) {
288+
continue;
289+
}
290+
if (is_a($class, RunnerInterface::class, true)) {
291+
return $class;
292+
}
293+
}
294+
295+
return null;
296+
}
275297
}

0 commit comments

Comments
 (0)