Completed
Push — v3 ( d12fea )
by Beñat
05:39
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 BenGorUser library.
5
 *
6
 * (c) Beñat Espiña <[email protected]>
7
 * (c) Gorka Laucirica <[email protected]>
8
 *
9
 * For the full copyright and license information, please view the LICENSE
10
 * file that was distributed with this source code.
11
 */
12
13
namespace BenatEspina\StackExchangeApiClient\Application\DataTransformer;
14
15
use BenatEspina\StackExchangeApiClient\Domain\Model\Response;
16
17
/**
18
 * Answer not transformation data transformer.
19
 *
20
 * @author Beñat Espiña <[email protected]>
21
 */
22
class ResponseNoTransformationDataTransformer implements DataTransformer
23
{
24
    /**
25
     * The response.
26
     *
27
     * @var Response
28
     */
29
    private $response;
30
31
    /**
32
     * {@inheritdoc}
33
     */
34
    public function write(Response $response)
35
    {
36
        $this->response = $response;
37
    }
38
39
    /**
40
     * {@inheritdoc}
41
     */
42
    public function read()
43
    {
44
        if (null === $this->response) {
45
            return [];
46
        }
47
48
        return $this->response;
49
    }
50
}
51