Passed
Branch release (695ec7)
by Henry
04:31
created

JsonBuilder::getBody()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 4
rs 10
1
<?php
2
/**
3
 * This file is part of the Divergence package.
4
 *
5
 * (c) Henry Paradiz <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
namespace Divergence\Responders;
11
12
use GuzzleHttp\Psr7\Stream;
13
use Divergence\Helpers\JSON;
14
use Psr\Http\Message\StreamInterface;
15
16
class JsonBuilder extends ResponseBuilder
17
{
18
    protected string $contentType = 'application/json';
19
20
    public function getBody(): StreamInterface
21
    {
22
        $output = json_encode(JSON::translateObjects($this->data));
23
        return \GuzzleHttp\Psr7\stream_for($output);
24
    }
25
}
26