DomainEventStream   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
c 1
b 0
f 0
lcom 1
cbo 0
dl 0
loc 41
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A all() 0 4 1
A getIterator() 0 4 1
A count() 0 4 1
1
<?php
2
/*
3
 * This file is part of the Borobudur-Event-Sourcing package.
4
 *
5
 * (c) Hexacodelabs <http://hexacodelabs.com>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace Borobudur\EventSourcing\Domain;
12
13
use ArrayIterator;
14
15
/**
16
 * @author      Iqbal Maulana <[email protected]>
17
 * @created     8/20/15
18
 */
19
class DomainEventStream implements DomainEventStreamInterface
20
{
21
    /**
22
     * @var array
23
     */
24
    private $events = array();
25
26
    /**
27
     * Constructor.
28
     *
29
     * @param DomainMessageInterface[] $events
30
     */
31
    public function __construct(array $events)
32
    {
33
        $this->events = $events;
34
    }
35
36
    /**
37
     * {@inheritdoc}
38
     */
39
    public function all()
40
    {
41
        return $this->events;
42
    }
43
44
    /**
45
     * {@inheritdoc}
46
     */
47
    public function getIterator()
48
    {
49
        return new ArrayIterator($this->events);
50
    }
51
52
    /**
53
     * {@inheritdoc}
54
     */
55
    public function count()
56
    {
57
        return count($this->events);
58
    }
59
}
60