ReversedTrait   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 16
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0
wmc 2
lcom 0
cbo 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A reversed() 0 8 2
1
<?php
2
/**
3
 * @copyright Zicht Online <http://zicht.nl>
4
 */
5
6
namespace Zicht\Itertools\lib\Traits;
7
8
use Zicht\Itertools\lib\ReversedIterator;
9
10
trait ReversedTrait
11
{
12
    /**
13
     * Returns an iterable with all the elements from this iterable reversed
14
     *
15
     * @return ReversedIterator
16
     */
17 5
    public function reversed()
18
    {
19 5
        if ($this instanceof \Iterator) {
20 4
            return new ReversedIterator($this);
21
        }
22
23 1
        return null;
24
    }
25
}
26