Response::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 2
c 1
b 0
f 1
nc 1
nop 2
dl 0
loc 4
ccs 3
cts 3
cp 1
crap 1
rs 10
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