Completed
Push — master ( f87b82...3f7aa1 )
by Mario
02:46
created

ResponseParser   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

Importance

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

1 Method

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