Completed
Push — master ( 1d94aa...24ca76 )
by Roj
02:51
created

Notifications::count()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php
2
3
namespace Rojtjo\Notifier;
4
5
use ArrayIterator;
6
use Countable;
7
use IteratorAggregate;
8
9
class Notifications implements IteratorAggregate, Countable
10
{
11
    /**
12
     * @var array
13
     */
14
    private $notifications;
15
16
    /**
17
     * @param array $notifications
18
     */
19 9
    public function __construct(array $notifications = [])
20
    {
21 9
        $this->notifications = $notifications;
22 9
    }
23
24
    /**
25
     * @return ArrayIterator
26
     */
27 3
    public function getIterator()
28
    {
29 3
        return new ArrayIterator($this->notifications);
30
    }
31
32
    /**
33
     * @return int
34
     */
35
    public function count()
36
    {
37
        return count($this->notifications);
38
    }
39
}
40