Skip to content

Commit

Permalink
Better check for editor arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
barryvdh committed Feb 13, 2024
1 parent b799677 commit e2523e6
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/LaravelDebugbar.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,9 @@ class LaravelDebugbar extends DebugBar
*/
protected $is_lumen = false;

protected array $editorTemplateArgs = [];
protected ?string $editorTemplateLink = null;
protected array $remoteServerReplacements = [];


/**
* @param Application $app
Expand Down Expand Up @@ -141,7 +143,8 @@ public function boot()
/** @var Application $app */
$app = $this->app;

$this->editorTemplateArgs = [$this->app['config']->get('debugbar.editor'), $this->getRemoteServerReplacements()];
$this->editorTemplateLink = $this->app['config']->get('debugbar.editor') ?: null;
$this->remoteServerReplacements = $this->getRemoteServerReplacements();

// Set custom error handler
if ($app['config']->get('debugbar.error_handler', false)) {
Expand Down Expand Up @@ -635,9 +638,11 @@ public function addCollector(DataCollectorInterface $collector)
if (method_exists($collector, 'useHtmlVarDumper')) {
$collector->useHtmlVarDumper();
}
if (method_exists($collector, 'setEditorLinkTemplate') && isset($this->editorTemplateArgs[0], $this->editorTemplateArgs[1])) {
$collector->setEditorLinkTemplate($this->editorTemplateArgs[0]);
$collector->addXdebugReplacements($this->editorTemplateArgs[1]);
if (method_exists($collector, 'setEditorLinkTemplate') && $this->editorTemplateLink) {
$collector->setEditorLinkTemplate($this->editorTemplateLink);
}
if (method_exists($collector, 'addXdebugReplacements') && $this->remoteServerReplacements) {
$collector->addXdebugReplacements($this->remoteServerReplacements);
}

return $this;
Expand Down

0 comments on commit e2523e6

Please sign in to comment.