Completed
Push — v3 ( d12fea...862d0b )
by Beñat
03:42
created

ResponseNoTransformationDataTransformer   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 29
wmc 3
lcom 1
cbo 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A write() 0 4 1
A read() 0 8 2
1
<?php
2
3
/*
4
 * This file is part of the Stack Exchange Api Client library.
5
 *
6
 * Copyright (c) 2014-2016 Beñat Espiña <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace BenatEspina\StackExchangeApiClient\Application\DataTransformer;
13
14
use Psr\Http\Message\ResponseInterface as Response;
15
16
/**
17
 * Answer not transformation data transformer.
18
 *
19
 * @author Beñat Espiña <[email protected]>
20
 */
21
class ResponseNoTransformationDataTransformer implements DataTransformer
22
{
23
    /**
24
     * The response.
25
     *
26
     * @var Response
27
     */
28
    private $response;
29
30
    /**
31
     * {@inheritdoc}
32
     */
33
    public function write(Response $response)
34
    {
35
        $this->response = $response;
36
    }
37
38
    /**
39
     * {@inheritdoc}
40
     */
41
    public function read()
42
    {
43
        if (null === $this->response) {
44
            return [];
45
        }
46
47
        return $this->response;
48
    }
49
}
50