KeysTrait   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 18
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0
wmc 3
lcom 0
cbo 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A keys() 0 10 3
1
<?php
2
/**
3
 * @copyright Zicht Online <http://zicht.nl>
4
 */
5
6
namespace Zicht\Itertools\lib\Traits;
7
8
trait KeysTrait
9
{
10
    /**
11
     * Returns an array with keys from this iterator
12
     *
13
     * @return array
14
     */
15 22
    public function keys()
16
    {
17 22
        $keys = [];
18 22
        if ($this instanceof \Traversable) {
19 22
            foreach ($this as $key => $value) {
20 16
                $keys [] = $key;
21
            }
22
        }
23 22
        return $keys;
24
    }
25
}
26