diff --git a/src/Interfaces/Response/IContent.php b/src/Interfaces/Response/IContent.php index fef4842..c93e94b 100644 --- a/src/Interfaces/Response/IContent.php +++ b/src/Interfaces/Response/IContent.php @@ -2,7 +2,9 @@ interface IContent { - public function &getData(): array; + public function setData(array $data): void; + + public function getData(): array; public function render(): void; diff --git a/src/Response/ContentBase.php b/src/Response/ContentBase.php index 31d0053..10cfafc 100644 --- a/src/Response/ContentBase.php +++ b/src/Response/ContentBase.php @@ -6,7 +6,12 @@ abstract class ContentBase implements IContent { protected array $data; - public function &getData(): array + public function setData(array $data): void + { + $this->data = $data; + } + + public function getData(): array { return $this->data; } diff --git a/src/Response/HtmlContent.php b/src/Response/HtmlContent.php index b5c9d6c..377b32e 100644 --- a/src/Response/HtmlContent.php +++ b/src/Response/HtmlContent.php @@ -6,10 +6,10 @@ class HtmlContent extends ContentBase { private string $view; - public function __construct(string $view, array &$data = []) + public function __construct(string $view, array $data = []) { $this->view = $view; - $this->data = &$data; + $this->data = $data; } public function render(): void diff --git a/src/Response/JsonContent.php b/src/Response/JsonContent.php index c2ecac0..9632328 100644 --- a/src/Response/JsonContent.php +++ b/src/Response/JsonContent.php @@ -2,9 +2,9 @@ class JsonContent extends ContentBase { - public function __construct(array &$data = []) + public function __construct(array $data = []) { - $this->data = &$data; + $this->data = $data; } public function render(): void