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

ResponseNoTransformationDataTransformer::read()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 8
rs 9.4285
cc 2
eloc 4
nc 2
nop 0
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