Skip to content

Commit 8b3ce64

Browse files
jefharbarryvdh
andauthored
Update JavascriptRenderer.php (php-debugbar#730)
Update baseUrl path to reflect new installation. --------- Co-authored-by: Barry vd. Heuvel <[email protected]>
1 parent a27cbd6 commit 8b3ce64

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/DebugBar/JavascriptRenderer.php

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,16 +101,20 @@ public function __construct(DebugBar $debugBar, $baseUrl = null, $basePath = nul
101101
{
102102
$this->debugBar = $debugBar;
103103

104-
if ($baseUrl === null) {
105-
$baseUrl = '/vendor/maximebf/debugbar/src/DebugBar/Resources';
106-
}
107-
$this->baseUrl = $baseUrl;
108-
109104
if ($basePath === null) {
110105
$basePath = __DIR__ . DIRECTORY_SEPARATOR . 'Resources';
111106
}
112107
$this->basePath = $basePath;
113108

109+
if ($baseUrl === null) {
110+
if ($basePath && str_contains($basePath, '/vendor/')) {
111+
$baseUrl = strstr($basePath, '/vendor/');
112+
} else {
113+
$baseUrl = '/vendor/php-debugbar/php-debugbar/src/DebugBar/Resources';
114+
}
115+
}
116+
$this->baseUrl = $baseUrl;
117+
114118
// bitwise operations cannot be done in class definition :(
115119
$this->initialization = self::INITIALIZE_CONSTRUCTOR | self::INITIALIZE_CONTROLS;
116120
}

0 commit comments

Comments
 (0)