blob: 8773e42a65f294fdc02bda5fa4ffbacc140049c8 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
<?php
declare(strict_types=1);
namespace AugustOffensive\View;
use AugustOffensive\Model;
/**
* Output formats for Results that are returned to the client.
*/
class Output
{
/**
* Formats the result into JSON.
*
* @param Model\Result $result The result to return to the client.
* @param bool $prepare Whether to set the content type of the response (default true).
*
* @return string
*/
public static function json (Model\Result $result, bool $prepare = true): string
{
return json_encode(array(
"Result-Type" => $result->getResultType(),
"Content" => $result->getResult()
));
}
}
|