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

JsonBuilder   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 8
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 8
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A getBody() 0 4 1
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