JSONResponseDataSerializer   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 1
dl 0
loc 12
rs 10
c 0
b 0
f 0
ccs 2
cts 2
cp 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A serialize() 0 4 1
1
<?php
2
namespace LunixRESTBasics\APIResponse;
3
4
use LunixREST\Server\APIResponse\APIResponseData;
5
use LunixREST\Server\ResponseFactory\APIResponseDataSerializer;
6
use Psr\Http\Message\StreamInterface;
7
8
/**
9
 * Class JSONResponse
10
 * @package LunixRESTBasics\APIResponse
11
 */
12
class JSONResponseDataSerializer implements APIResponseDataSerializer
13
{
14
15
    /**
16
     * @param APIResponseData $responseData
17
     * @return StreamInterface
18
     */
19 1
    public function serialize(APIResponseData $responseData): StreamInterface
20
    {
21 1
        return \GuzzleHttp\Psr7\Stream_for(json_encode($responseData->getData()));
22
    }
23
}
24