PreAggregateGroup   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 56
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 2
dl 0
loc 56
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getGroup() 0 4 1
A addEntry() 0 6 1
A getCount() 0 4 1
A setCount() 0 4 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
}