2020-05-31 20:41:16 +02:00
|
|
|
<?php namespace MapGuesser\Response;
|
2020-05-19 03:13:55 +02:00
|
|
|
|
2020-05-31 20:41:16 +02:00
|
|
|
class JsonContent extends ContentBase
|
2020-05-19 03:13:55 +02:00
|
|
|
{
|
|
|
|
public function __construct(array &$data = [])
|
|
|
|
{
|
|
|
|
$this->data = &$data;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function &render(): string
|
|
|
|
{
|
|
|
|
$content = json_encode($this->data);
|
|
|
|
|
|
|
|
return $content;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getContentType(): string
|
|
|
|
{
|
|
|
|
return 'application/json';
|
|
|
|
}
|
|
|
|
}
|