ObservationCollection   A
last analyzed

Complexity

Total Complexity 11

Size/Duplication

Total Lines 57
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 11
eloc 14
dl 0
loc 57
c 0
b 0
f 0
ccs 0
cts 28
cp 0
rs 10

11 Methods

Rating   Name   Duplication   Size   Complexity  
A key() 0 3 1
A next() 0 3 1
A addError() 0 3 1
A empty() 0 3 1
A rewind() 0 3 1
A addInfo() 0 3 1
A __construct() 0 3 1
A addKudos() 0 3 1
A valid() 0 3 1
A current() 0 3 1
A addWarning() 0 3 1
1
<?php declare(strict_types=1);
2
3
/**
4
 * @license  http://opensource.org/licenses/mit-license.php MIT
5
 * @link     https://github.com/nicoSWD
6
 * @author   Nicolas Oelgart <[email protected]>
7
 */
8
namespace nicoSWD\SecHeaderCheck\Domain\Result;
9
10
use Iterator;
11
use SplObjectStorage;
12
13
final class ObservationCollection implements Iterator
14
{
15
    private $storage;
16
17
    public function __construct()
18
    {
19
        $this->storage = new SplObjectStorage();
20
    }
21
22
    public function addWarning(Warning $warning): void
23
    {
24
        $this->storage->attach($warning);
25
    }
26
27
    public function addKudos(Kudos $kudos): void
28
    {
29
        $this->storage->attach($kudos);
30
    }
31
32
    public function addInfo(Info $info): void
33
    {
34
        $this->storage->attach($info);
35
    }
36
37
    public function addError(Error $error): void
38
    {
39
        $this->storage->attach($error);
40
    }
41
42
    public function empty(): bool
43
    {
44
        return $this->storage->count() === 0;
45
    }
46
47
    public function current()
48
    {
49
        return $this->storage->current();
50
    }
51
52
    public function next()
53
    {
54
        $this->storage->next();
55
    }
56
57
    public function key()
58
    {
59
        return $this->storage->key();
60
    }
61
62
    public function valid()
63
    {
64
        return $this->storage->valid();
65
    }
66
67
    public function rewind()
68
    {
69
        $this->storage->rewind();
70
    }
71
}
72