PreAggregateGroup::__construct()   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 PreAggregateGroup
7
 *
8
 * @author Dave Www <[email protected]>
9
 */
10
class PreAggregateGroup implements \Iterator
11
{
12
    use EntriesTrait;
13
14
    /**
15
     * @var int
16
     */
17
    private $count;
18
19
    /**
20
     * @var GroupKey
21
     */
22
    private $group;
23
24
    /**
25
     * @param GroupKey $group
26
     */
27
    public function __construct(GroupKey $group)
28
    {
29
        $this->group = $group;
30
    }
31
32
    /**
33
     * @return GroupKey
34
     */
35
    public function getGroup()
36
    {
37
        return $this->group;
38
    }
39
40
    /**
41
     * @param PreAggregate $aggregate
42
     */
43
    public function addEntry(PreAggregate $aggregate)
44
    {
45
        $this->entries[] = $aggregate;
46
47
        $this->count += $aggregate->getCount();
48
    }
49
50
    /**
51
     * @return int
52
     */
53
    public function getCount()
54
    {
55
        return $this->count;
56
    }
57
58
    /**
59
     * @param int $count
60
     */
61
    public function setCount($count)
62
    {
63
        $this->count = $count;
64
    }
65
}