mapguesser/src/Response/JsonContent.php

22 lines
388 B
PHP
Raw Normal View History

2020-05-31 20:41:16 +02:00
<?php namespace MapGuesser\Response;
2020-05-31 20:41:16 +02:00
class JsonContent extends ContentBase
{
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';
}
}