aboutsummaryrefslogtreecommitdiff
path: root/private/View/Output.php
blob: af9975eb23a36714113492b5581c472ca3496a3f (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
<?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.
     *
     * @return string
     */
    public static function json (Model\Result $result): string
    {
        return json_encode(array(
            "Result-Type" => $result->getResultType(),
            "Content" => $result->getResult()
        ));
    }
}