ConvertJsonToArrayBehaviour   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 1
dl 0
loc 22
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A behave() 0 11 1
1
<?php
2
/**
3
 * @author stev leibelt <[email protected]>
4
 * @since 2015-12-09
5
 */
6
namespace Net\Bazzline\Component\Curl\ResponseBehaviour;
7
8
use Exception;
9
use Net\Bazzline\Component\Curl\Response\Response;
10
11
class ConvertJsonToArrayBehaviour implements ResponseBehaviourInterface
12
{
13
    /**
14
     * Since the Response is immutable, each behaviour has to return a new
15
     *  Response instance
16
     *
17
     * @param Response $response
18
     * @return Response
19
     * @throws Exception
20
     */
21
    public function behave(Response $response)
22
    {
23
        return new Response(
24
            json_decode($response->content(), true),
25
            $response->contentType(),
26
            $response->error(),
27
            $response->errorCode(),
28
            $response->headerLines(),
29
            $response->statusCode()
30
        );
31
    }
32
}
33