Passed
Push — master ( 1a17c3...faad8c )
by
unknown
01:09
created

DataContainerIteratorAggregateTrait::getIterator()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
ccs 3
cts 3
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * Copyright MediaCT. All rights reserved.
4
 * https://www.mediact.nl
5
 */
6
7
namespace Mediact\DataContainer;
8
9
use ArrayIterator;
10
use Traversable;
11
12
/**
13
 * Implements IteratorAggregate
14
 */
15
trait DataContainerIteratorAggregateTrait
16
{
17
    /**
18
     * Retrieve an external iterator
19
     *
20
     * @return Traversable
21
     */
22 1
    public function getIterator(): Traversable
23
    {
24 1
        return new ArrayIterator(
25 1
            $this->getStorage()->all()
26
        );
27
    }
28
29
    /**
30
     * Get the storage.
31
     *
32
     * @return DataContainerInterface
33
     */
34
    abstract protected function getStorage(): DataContainerInterface;
35
}
36