Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 47e4b8e

Browse filesBrowse files
committed
feature #39051 [WebProfilerBundle] Possibility to dynamically set mode (brusch)
This PR was squashed before being merged into the 5.3-dev branch. Discussion ---------- [WebProfilerBundle] Possibility to dynamically set mode | Q | A | ------------- | --- | Branch? | 5.x | Bug fix? | no | New feature? | no | Deprecations? | no | License | MIT Sometimes it is necessary to dynamically decide whether the debug toolbar should be injected or not. Commits ------- 7c5cf57 [WebProfilerBundle] Possibility to dynamically set mode
2 parents 70ed003 + 7c5cf57 commit 47e4b8e
Copy full SHA for 47e4b8e

File tree

1 file changed

+9
-0
lines changed
Filter options

1 file changed

+9
-0
lines changed

‎src/Symfony/Bundle/WebProfilerBundle/EventListener/WebDebugToolbarListener.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/WebProfilerBundle/EventListener/WebDebugToolbarListener.php
+9Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,15 @@ public function isEnabled(): bool
6060
return self::DISABLED !== $this->mode;
6161
}
6262

63+
public function setMode(int $mode): void
64+
{
65+
if (self::DISABLED !== $mode && self::ENABLED !== $mode) {
66+
throw new \InvalidArgumentException(sprintf('Invalid value provided for mode, use one of "%s::DISABLED" or "%s::ENABLED".', self::class, self::class));
67+
}
68+
69+
$this->mode = $mode;
70+
}
71+
6372
public function onKernelResponse(ResponseEvent $event)
6473
{
6574
$response = $event->getResponse();

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.