MAPG-191 don't pass data by reference to IContent
This commit is contained in:
parent
091afb0aab
commit
e17cf68007
@ -2,7 +2,9 @@
|
||||
|
||||
interface IContent
|
||||
{
|
||||
public function &getData(): array;
|
||||
public function setData(array $data): void;
|
||||
|
||||
public function getData(): array;
|
||||
|
||||
public function render(): void;
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user