DataContainerIteratorAggregateTrait   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A getIterator() 0 4 1
1
<?php
2
3
/**
4
 * Copyright MediaCT. All rights reserved.
5
 * https://www.mediact.nl
6
 */
7
8
namespace Mediact\DataContainer;
9
10
use ArrayIterator;
11
use Traversable;
12
13
/**
14
 * Implements IteratorAggregate
15
 *
16
 * @deprecated IteratorAggregate is implemented by DataContainerDecoratorTrait.
17
 */
18
trait DataContainerIteratorAggregateTrait
19
{
20
    /**
21
     * Retrieve an external iterator
22
     *
23
     * @return Traversable
24
     */
25 1
    public function getIterator(): Traversable
26
    {
27 1
        return new ArrayIterator(
28 1
            $this->getStorage()->all()
29
        );
30
    }
31
32
    /**
33
     * Get the storage.
34
     *
35
     * @return DataContainerInterface
36
     */
37
    abstract protected function getStorage(): DataContainerInterface;
38
}
39