NativeResponseParser   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
c 1
b 0
f 0
lcom 0
cbo 1
dl 0
loc 19
ccs 7
cts 7
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A parse() 0 13 1
1
<?php
2
3
namespace Marek\Toggable\Http\Parser;
4
5
use Marek\Toggable\API\Http\Response\Response;
6
7
/**
8
 * Class NativeResponseParser
9
 * @package Marek\Toggable\Http\Parser
10
 */
11
class NativeResponseParser implements HttpResponseParserInterface
12
{
13
    /**
14
     * @inheritDoc
15
     */
16 2
    public function parse(array $data)
17
    {
18 2
        $body = json_decode($data['data'], true);
19
20 2
        sscanf($data['metadata'][0], 'HTTP/%*d.%*d %d', $statusCode);
21
22 2
        return new Response(
23
            array(
24 2
                'statusCode' => $statusCode,
25 2
                'body' => $body,
26
            )
27 2
        );
28
    }
29
}
30