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

DataContainerIteratorAggregateTrait   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 20
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A getIterator() 0 4 1
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