PreAggregate::setData()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
namespace Dwo\Aggregator\Model;
4
5
/**
6
 * Class PreAggregate
7
 *
8
 * @author Dave Www <[email protected]>
9
 */
10
class PreAggregate
11
{
12
    /**
13
     * @var array
14
     */
15
    protected $data;
16
17
    /**
18
     * @var string|null
19
     */
20
    protected $id;
21
22
    /**
23
     * @var int
24
     */
25
    protected $count;
26
27
    /**
28
     * :TODO: refactor construct
29
     *
30
     * @param array       $data
31
     * @param string|null $id
32
     * @param int         $count
33
     */
34
    public function __construct($data, $id = null, $count = 1)
35
    {
36
        $this->data = $data;
37
        $this->id = $id;
38
        $this->count = $count;
39
    }
40
41
    /**
42
     * @return array
43
     */
44
    public function getData()
45
    {
46
        return (array) $this->data;
47
    }
48
49
    /**
50
     * @param array $data
51
     */
52
    public function setData(array $data)
53
    {
54
        $this->data = $data;
55
    }
56
57
    /**
58
     * @return null|string
59
     */
60
    public function getId()
61
    {
62
        return $this->id;
63
    }
64
65
    /**
66
     * @return int
67
     */
68
    public function getCount()
69
    {
70
        return (int) $this->count;
71
    }
72
73
    /**
74
     * @param int $count
75
     */
76
    public function incrementCount($count = 1)
77
    {
78
        $this->count += $count;
79
    }
80
}