ObservationCollection::addWarning()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
c 0
b 0
f 0
ccs 0
cts 2
cp 0
rs 10
cc 1
nc 1
nop 1
crap 2
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