Test Failed
Push — master ( faad8c...154f3e )
by Rieks
03:16
created

DataContainerIteratorAggregateTrait::getIterator()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
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
    public function getIterator(): Traversable
23
    {
24
        return new ArrayIterator(
25
            $this->getStorage()->all()
26
        );
27
    }
28
29
    /**
30
     * Get the storage.
31
     *
32
     * @return DataContainerInterface
33
     */
34
    abstract protected function getStorage(): DataContainerInterface;
35
}
36