From 67f8876f6ecba3b5daa701b667dbc3be63eb6c83 Mon Sep 17 00:00:00 2001 From: Mostafa Khudair <59371810+mostafakhudair@users.noreply.github.com> Date: Mon, 9 Oct 2023 22:34:52 +0300 Subject: [PATCH 1/3] refactor: ViewDecoratorTrait Use `View::$config` instead of `config()` function --- system/View/ViewDecoratorTrait.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/system/View/ViewDecoratorTrait.php b/system/View/ViewDecoratorTrait.php index 97cdbe0a252d..da7a57189981 100644 --- a/system/View/ViewDecoratorTrait.php +++ b/system/View/ViewDecoratorTrait.php @@ -12,7 +12,6 @@ namespace CodeIgniter\View; use CodeIgniter\View\Exceptions\ViewException; -use Config\View as ViewConfig; trait ViewDecoratorTrait { @@ -22,9 +21,7 @@ trait ViewDecoratorTrait */ protected function decorateOutput(string $html): string { - $decorators = \config(ViewConfig::class)->decorators; - - foreach ($decorators as $decorator) { + foreach ($this->config->decorators as $decorator) { if (! is_subclass_of($decorator, ViewDecoratorInterface::class)) { throw ViewException::forInvalidDecorator($decorator); } From 753fe0ea0ab8ee4bab0467a3bcf4a97989ce96ba Mon Sep 17 00:00:00 2001 From: Mostafa Khudair <59371810+mostafakhudair@users.noreply.github.com> Date: Wed, 13 Dec 2023 20:03:02 +0200 Subject: [PATCH 2/3] Update system/View/ViewDecoratorTrait.php Co-authored-by: MGatner --- system/View/ViewDecoratorTrait.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/system/View/ViewDecoratorTrait.php b/system/View/ViewDecoratorTrait.php index da7a57189981..3f52b72a8ab9 100644 --- a/system/View/ViewDecoratorTrait.php +++ b/system/View/ViewDecoratorTrait.php @@ -21,7 +21,9 @@ trait ViewDecoratorTrait */ protected function decorateOutput(string $html): string { - foreach ($this->config->decorators as $decorator) { + $decorators = $this->config->decorators ?? \config(ViewConfig::class)->decorators; + + foreach ($decorators as $decorator) { if (! is_subclass_of($decorator, ViewDecoratorInterface::class)) { throw ViewException::forInvalidDecorator($decorator); } From 73bf083a3fa089f58a1b1b1511e40657fe992b3d Mon Sep 17 00:00:00 2001 From: Mostafa Khudair <59371810+mostafakhudair@users.noreply.github.com> Date: Thu, 21 Dec 2023 21:30:22 +0200 Subject: [PATCH 3/3] Update ViewDecoratorTrait.php --- system/View/ViewDecoratorTrait.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/system/View/ViewDecoratorTrait.php b/system/View/ViewDecoratorTrait.php index 3f52b72a8ab9..1bec8acf012a 100644 --- a/system/View/ViewDecoratorTrait.php +++ b/system/View/ViewDecoratorTrait.php @@ -12,6 +12,7 @@ namespace CodeIgniter\View; use CodeIgniter\View\Exceptions\ViewException; +use Config\View as ViewConfig; trait ViewDecoratorTrait { @@ -21,7 +22,7 @@ trait ViewDecoratorTrait */ protected function decorateOutput(string $html): string { - $decorators = $this->config->decorators ?? \config(ViewConfig::class)->decorators; + $decorators = $this->config->decorators ?? config(ViewConfig::class)->decorators; foreach ($decorators as $decorator) { if (! is_subclass_of($decorator, ViewDecoratorInterface::class)) {