From 51da5d7a9afd128a4fd8b3536b225f8be51fd859 Mon Sep 17 00:00:00 2001 From: AJ Meireles Date: Wed, 18 Sep 2024 09:22:06 -0300 Subject: [PATCH] enhancements --- src/Response/PreventInjection.php | 2 +- src/Response/Render.php | 1 - src/Response/ResponseHandle.php | 4 ++++ src/View/Components/BaseComponent.php | 3 --- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Response/PreventInjection.php b/src/Response/PreventInjection.php index 3778a93..3407767 100644 --- a/src/Response/PreventInjection.php +++ b/src/Response/PreventInjection.php @@ -82,7 +82,7 @@ private function forEnvironments(): bool */ private function forMobile(): bool { - if (config('envbar.on_mobile')) { + if (config('envbar.on_mobile') === true) { return false; } diff --git a/src/Response/Render.php b/src/Response/Render.php index 7ace31a..ef7a57b 100644 --- a/src/Response/Render.php +++ b/src/Response/Render.php @@ -44,7 +44,6 @@ public static function js(): Htmlable public function component(): View { return view('envbar::components.envbar', [ - 'id' => uniqid(), 'show' => Cache::pull('envbar::show'), ...app(EnvBarComponentCompiler::class)(), ]); diff --git a/src/Response/ResponseHandle.php b/src/Response/ResponseHandle.php index 029cdb7..18c9e5a 100644 --- a/src/Response/ResponseHandle.php +++ b/src/Response/ResponseHandle.php @@ -18,6 +18,10 @@ public function __invoke(): Response { $content = $this->response->getContent(); + if ($content === false) { + return $this->response; + } + if (($head = strpos($content, '')) !== false) { $content = substr_replace($content, $this->render->css(), $head + 6, 0); // @phpstan-ignore-line $content = substr_replace($content, $this->render->js(), $head + 6, 0); // @phpstan-ignore-line diff --git a/src/View/Components/BaseComponent.php b/src/View/Components/BaseComponent.php index 5632f37..3d1d20c 100644 --- a/src/View/Components/BaseComponent.php +++ b/src/View/Components/BaseComponent.php @@ -8,9 +8,6 @@ abstract class BaseComponent extends Component { - /** Runtime configurations obtained from the EnvBar component. */ - public array $configuration = []; - abstract public function blade(): View; public function render(): Closure