Response   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 13
c 1
b 0
f 1
dl 0
loc 50
ccs 17
cts 17
cp 1
rs 10
wmc 6

6 Methods

Rating   Name   Duplication   Size   Complexity  
A addMeta() 0 5 1
A getData() 0 3 1
A setMeta() 0 5 1
A __construct() 0 4 1
A getMeta() 0 3 1
A setData() 0 5 1
1
<?php declare(strict_types=1);
2
3
namespace Artprima\QueryFilterBundle\Response;
4
5
/**
6
 * Class Response
7
 *
8
 * @author Denis Voytyuk <[email protected]>
9
 */
10
class Response implements ResponseInterface
11
{
12
    /**
13
     * @var mixed filtered data
14
     */
15
    private $data;
16
17
    /**
18
     * @var array meta data (e.g. pagination info)
19
     */
20
    private $meta;
21
22 6
    public function __construct($data = null, array $meta = array())
23
    {
24 6
        $this->data = $data;
25 6
        $this->meta = $meta;
26 6
    }
27
28 4
    public function getData()
29
    {
30 4
        return $this->data;
31
    }
32
33 4
    public function setData($data): ResponseInterface
34
    {
35 4
        $this->data = $data;
36
37 4
        return $this;
38
    }
39
40
    /**
41
     * @return array
42
     */
43 5
    public function getMeta(): array
44
    {
45 5
        return $this->meta;
46
    }
47
48 1
    public function setMeta(array $meta): ResponseInterface
49
    {
50 1
        $this->meta = $meta;
51
52 1
        return $this;
53
    }
54
55 4
    public function addMeta(string $field, $value): ResponseInterface
56
    {
57 4
        $this->meta[$field] = $value;
58
59 4
        return $this;
60
    }
61
}
62